Commit 7cdf01df authored by Unicorn369's avatar Unicorn369

支持使用自定义链接更换头像

parent 12876032
...@@ -392,12 +392,8 @@ public class Servant ...@@ -392,12 +392,8 @@ public class Servant
public string currentMShash; public string currentMShash;
public string nameFace;
private GameObject currentMSwindow = null; private GameObject currentMSwindow = null;
private GameObject currentMSwindow_Face = null;
public class messageSystemValue public class messageSystemValue
{ {
public string value = ""; public string value = "";
...@@ -769,6 +765,12 @@ public class Servant ...@@ -769,6 +765,12 @@ public class Servant
Program.I().cardDescription.mLog(hint); Program.I().cardDescription.mLog(hint);
} }
UIInput inputUrl;
public string nameFace;
private GameObject currentMSwindow_Face = null;
public void RMSshow_face(string hashCode, string name) public void RMSshow_face(string hashCode, string name)
{ {
RMSshow_clear(); RMSshow_clear();
...@@ -787,6 +789,7 @@ public class Servant ...@@ -787,6 +789,7 @@ public class Servant
nameFace = name; nameFace = name;
currentMSwindow_Face = currentMSwindow; currentMSwindow_Face = currentMSwindow;
UIHelper.InterGameObject(currentMSwindow); UIHelper.InterGameObject(currentMSwindow);
inputUrl = UIHelper.getByName<UIInput>(currentMSwindow, "input_");
UIHelper.getByName<UITexture>(currentMSwindow, "face_").mainTexture = UIHelper.getFace(name); UIHelper.getByName<UITexture>(currentMSwindow, "face_").mainTexture = UIHelper.getFace(name);
UIHelper.registEvent(currentMSwindow, "exit_", ES_RMSpremono, new messageSystemValue()); UIHelper.registEvent(currentMSwindow, "exit_", ES_RMSpremono, new messageSystemValue());
UIHelper.registEvent(currentMSwindow, "yes_", DownloadFace); UIHelper.registEvent(currentMSwindow, "yes_", DownloadFace);
...@@ -794,14 +797,19 @@ public class Servant ...@@ -794,14 +797,19 @@ public class Servant
public void DownloadFace() public void DownloadFace()
{ {
//获取QQ号 string url = "http://q1.qlogo.cn/headimg_dl?dst_uin=" + inputUrl.value + "&spec=100";
UIInput inputHttp = UIHelper.getByName<UIInput>(currentMSwindow_Face, "input_");
//如果使用自定义url,而不是QQ头像,请修改url,改为:string url = inputHttp.value;
string url = "http://q1.qlogo.cn/headimg_dl?dst_uin=" + inputHttp.value + "&spec=100";
string face = "texture/face/" + nameFace + ".jpg"; string face = "texture/face/" + nameFace + ".jpg";
//开始下载 //开始下载
HttpDldFile df = new HttpDldFile(); HttpDldFile df = new HttpDldFile();
df.Download(url, face); if (inputUrl.value.Substring(0, 4) == "http")
{
url = inputUrl.value;
df.Download(url, face); //使用自定义Url
}
else
{
df.Download(url, face); //使用QQ头像
}
//刷新头像 //刷新头像
if (File.Exists(face)) if (File.Exists(face))
{ {
......
...@@ -890,7 +890,7 @@ Transform: ...@@ -890,7 +890,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1720769508036278} m_GameObject: {fileID: 1720769508036278}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -140, y: 12, z: 0} m_LocalPosition: {x: -200, y: 12, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4473934484648920} m_Father: {fileID: 4473934484648920}
...@@ -919,7 +919,7 @@ BoxCollider: ...@@ -919,7 +919,7 @@ BoxCollider:
m_IsTrigger: 1 m_IsTrigger: 1
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 280, y: 40, z: 0} m_Size: {x: 400, y: 40, z: 0}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!65 &65634783695434124 --- !u!65 &65634783695434124
BoxCollider: BoxCollider:
...@@ -978,13 +978,13 @@ MonoBehaviour: ...@@ -978,13 +978,13 @@ MonoBehaviour:
updateAnchors: 1 updateAnchors: 1
mColor: {r: 1, g: 1, b: 1, a: 1} mColor: {r: 1, g: 1, b: 1, a: 1}
mPivot: 4 mPivot: 4
mWidth: 280 mWidth: 400
mHeight: 40 mHeight: 40
mDepth: 30 mDepth: 30
autoResizeBoxCollider: 1 autoResizeBoxCollider: 1
hideIfOffScreen: 0 hideIfOffScreen: 0
keepAspectRatio: 0 keepAspectRatio: 0
aspectRatio: 7 aspectRatio: 10
mType: 1 mType: 1
mFillDirection: 4 mFillDirection: 4
mFillAmount: 1 mFillAmount: 1
...@@ -1014,7 +1014,7 @@ MonoBehaviour: ...@@ -1014,7 +1014,7 @@ MonoBehaviour:
onReturnKey: 0 onReturnKey: 0
keyboardType: 0 keyboardType: 0
hideInput: 0 hideInput: 0
validation: 1 validation: 0
characterLimit: 0 characterLimit: 0
savedAs: savedAs:
selectOnTab: {fileID: 0} selectOnTab: {fileID: 0}
...@@ -1135,17 +1135,17 @@ MonoBehaviour: ...@@ -1135,17 +1135,17 @@ MonoBehaviour:
updateAnchors: 1 updateAnchors: 1
mColor: {r: 1, g: 1, b: 1, a: 0.40392157} mColor: {r: 1, g: 1, b: 1, a: 0.40392157}
mPivot: 0 mPivot: 0
mWidth: 280 mWidth: 400
mHeight: 32 mHeight: 32
mDepth: 21 mDepth: 21
autoResizeBoxCollider: 0 autoResizeBoxCollider: 0
hideIfOffScreen: 0 hideIfOffScreen: 0
keepAspectRatio: 0 keepAspectRatio: 0
aspectRatio: 8.75 aspectRatio: 12.5
keepCrispWhenShrunk: 1 keepCrispWhenShrunk: 1
mTrueTypeFont: {fileID: 12800000, guid: f775853fdfd14bb47934543e95c3bae3, type: 3} mTrueTypeFont: {fileID: 12800000, guid: f775853fdfd14bb47934543e95c3bae3, type: 3}
mFont: {fileID: 0} mFont: {fileID: 0}
mText: "\u5728\u6B64\u8F93\u5165QQ\u53F7" mText: "QQ\u53F7 \u6216 \u56FE\u7247\u94FE\u63A5"
mFontSize: 27 mFontSize: 27
mFontStyle: 0 mFontStyle: 0
mAlignment: 2 mAlignment: 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment