|
@@ -126,7 +126,7 @@ public class HttpManager : Regist
|
|
|
public static int AnnounceIndex = -1;
|
|
|
public static bool IsAnnounceReady;
|
|
|
public static string AnnounceContent;
|
|
|
- public static Sprite AnnounceSpite;
|
|
|
+ public static Dictionary<string, Sprite> AnnounceSpiteDict = new Dictionary<string, Sprite>();
|
|
|
|
|
|
public static Button WifiButton;
|
|
|
|
|
@@ -516,6 +516,8 @@ public class HttpManager : Regist
|
|
|
XmlNode rootNode;
|
|
|
XmlDocument document = new XmlDocument();
|
|
|
|
|
|
+ //Debug.Log(xml);
|
|
|
+
|
|
|
//Debug.Log((int)xml[0]);
|
|
|
//Debug.Log((int)xml[xml.Length-1]);
|
|
|
//Debug.Log((int)xml[xml.Length - 2]);
|
|
@@ -530,7 +532,7 @@ public class HttpManager : Regist
|
|
|
{
|
|
|
document.LoadXml(xml);
|
|
|
|
|
|
- Debug.Log(document.OuterXml);
|
|
|
+ //Debug.Log(document.OuterXml);
|
|
|
|
|
|
rootNode = document.SelectSingleNode("announce");
|
|
|
|
|
@@ -560,35 +562,44 @@ public class HttpManager : Regist
|
|
|
|
|
|
public static void DecodeAnnounceData(XmlNode node, List<string> urlList)
|
|
|
{
|
|
|
- //Debug.Log(node.InnerText);
|
|
|
+ //Debug.Log(node.OuterXml);
|
|
|
+
|
|
|
XmlNodeList nodeList = node.SelectNodes("title");
|
|
|
|
|
|
for (int i = 0; i < nodeList.Count; i++)
|
|
|
{
|
|
|
- AnnounceManager.AddContent(false, nodeList[i].Attributes[0].Value, nodeList[i].InnerText, TextAnchor.MiddleLeft);
|
|
|
+ string language = nodeList[i].Attributes[0].Value;
|
|
|
+ NotifyTitle notifyTitle = new NotifyTitle(nodeList[i].InnerText);
|
|
|
+ AnnounceManager.AddItem(language, notifyTitle);
|
|
|
+ //AnnounceManager.AddContent(false, nodeList[i].Attributes[0].Value, nodeList[i].InnerText, TextAnchor.MiddleLeft);
|
|
|
}
|
|
|
|
|
|
- AnnounceManager.AddContent(false, "null", node.SelectSingleNode("date").InnerText, TextAnchor.MiddleLeft);
|
|
|
+ NotifyDate notifyDate = new NotifyDate(node.SelectSingleNode("date").InnerText);
|
|
|
+ AnnounceManager.AddItem("null", notifyDate);
|
|
|
+ //AnnounceManager.AddContent(false, "null", node.SelectSingleNode("date").InnerText, TextAnchor.MiddleLeft);
|
|
|
|
|
|
nodeList = node.SelectSingleNode("content").ChildNodes;
|
|
|
|
|
|
for (int i = 0; i < nodeList.Count; i++)
|
|
|
{
|
|
|
- //Debug.Log(nodeList[i].Name);
|
|
|
- //Debug.LogWarning(nodeList[i].Value);
|
|
|
if (nodeList[i].Name == "text")
|
|
|
{
|
|
|
- AnnounceManager.AddContent(false, nodeList[i].Attributes[0].Value, nodeList[i].InnerText, TextAnchor.MiddleLeft);
|
|
|
+ string language = nodeList[i].Attributes[0].Value;
|
|
|
+ NotifyContent notifyContent = new NotifyContent(nodeList[i].InnerText);
|
|
|
+ AnnounceManager.AddItem(language, notifyContent);
|
|
|
+ //AnnounceManager.AddContent(false, nodeList[i].Attributes[0].Value, nodeList[i].InnerText, TextAnchor.MiddleLeft);
|
|
|
}
|
|
|
else if (nodeList[i].Name == "image")
|
|
|
{
|
|
|
urlList.UniqueAdd(nodeList[i].InnerText);
|
|
|
|
|
|
- AnnounceManager.AddContent(true, "null", $"<({Path.GetFileNameWithoutExtension(nodeList[i].InnerText)})>", TextAnchor.MiddleCenter);
|
|
|
+ NotifyImage notifyImage = new NotifyImage(Path.GetFileNameWithoutExtension(nodeList[i].InnerText));
|
|
|
+ AnnounceManager.AddItem(nodeList[i].Attributes[0].Value, notifyImage);
|
|
|
+ //AnnounceManager.AddContent(true, "null", $"<({Path.GetFileNameWithoutExtension(nodeList[i].InnerText)})>", TextAnchor.MiddleCenter);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- AnnounceManager.AddContent(false, "null", "", TextAnchor.MiddleLeft);
|
|
|
+ //AnnounceManager.AddContent(false, "null", "", TextAnchor.MiddleLeft);
|
|
|
}
|
|
|
|
|
|
public static IEnumerator PullAnnounceSprite(List<string> urlList, Action<List<WWW>> callback)
|
|
@@ -610,43 +621,53 @@ public class HttpManager : Regist
|
|
|
|
|
|
public static void PullAnnounceSpriteCallback(List<WWW> wwwList)
|
|
|
{
|
|
|
- List<Texture2D> textureList = new List<Texture2D>();
|
|
|
- List<SpriteInfo> spriteInfoList = new List<SpriteInfo>();
|
|
|
-
|
|
|
for (int i = 0; i < wwwList.Count; i++)
|
|
|
{
|
|
|
- textureList.Add(wwwList[i].texture);
|
|
|
+ Texture2D texture = wwwList[i].texture;
|
|
|
+ Sprite sprite = Sprite.Create(wwwList[i].texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
|
|
|
+ sprite.name = Path.GetFileNameWithoutExtension(wwwList[i].url);
|
|
|
+ AnnounceSpiteDict.Add(sprite.name, sprite);
|
|
|
+ //Debug.Log(sprite.name);
|
|
|
+ }
|
|
|
+ IsAnnounceReady = true;
|
|
|
|
|
|
- SpriteInfo spriteInfo = new SpriteInfo();
|
|
|
- spriteInfo.Name = Path.GetFileNameWithoutExtension(wwwList[i].url);
|
|
|
+ //List<Texture2D> textureList = new List<Texture2D>();
|
|
|
+ //List<SpriteInfo> spriteInfoList = new List<SpriteInfo>();
|
|
|
|
|
|
- spriteInfoList.Add(spriteInfo);
|
|
|
- }
|
|
|
+ //for (int i = 0; i < wwwList.Count; i++)
|
|
|
+ //{
|
|
|
+ // textureList.Add(wwwList[i].texture);
|
|
|
|
|
|
- Texture2D atlas = new Texture2D(2048, 2048);
|
|
|
+ // SpriteInfo spriteInfo = new SpriteInfo();
|
|
|
+ // spriteInfo.Name = Path.GetFileNameWithoutExtension(wwwList[i].url);
|
|
|
|
|
|
- Rect[] rects = atlas.PackTextures(textureList.ToArray(), 1);
|
|
|
+ // spriteInfoList.Add(spriteInfo);
|
|
|
+ //}
|
|
|
|
|
|
- Sprite sprite = Sprite.Create(atlas, new Rect(0, 0, atlas.width, atlas.height), new Vector2(0.5f, 0.5f));
|
|
|
+ //Texture2D atlas = new Texture2D(2048, 2048);
|
|
|
|
|
|
- for (int i = 0; i < spriteInfoList.Count; i++)
|
|
|
- {
|
|
|
- spriteInfoList[i].Width = textureList[i].width;
|
|
|
- spriteInfoList[i].Height = textureList[i].height;
|
|
|
+ //Rect[] rects = atlas.PackTextures(textureList.ToArray(), 1);
|
|
|
|
|
|
- spriteInfoList[i].UvList = new List<Vector2>()
|
|
|
- {
|
|
|
- new Vector2(rects[i].xMin, rects[i].yMax),
|
|
|
- new Vector2(rects[i].xMax, rects[i].yMax),
|
|
|
- new Vector2(rects[i].xMax, rects[i].yMin),
|
|
|
- new Vector2(rects[i].xMin, rects[i].yMin),
|
|
|
- };
|
|
|
+ //Sprite sprite = Sprite.Create(atlas, new Rect(0, 0, atlas.width, atlas.height), new Vector2(0.5f, 0.5f));
|
|
|
|
|
|
- SpriteAsset.SpriteInfoDic.Add(spriteInfoList[i].Name, spriteInfoList[i]);
|
|
|
- }
|
|
|
+ //for (int i = 0; i < spriteInfoList.Count; i++)
|
|
|
+ //{
|
|
|
+ // spriteInfoList[i].Width = textureList[i].width;
|
|
|
+ // spriteInfoList[i].Height = textureList[i].height;
|
|
|
|
|
|
- AnnounceSpite = sprite;
|
|
|
- IsAnnounceReady = true;
|
|
|
+ // spriteInfoList[i].UvList = new List<Vector2>()
|
|
|
+ // {
|
|
|
+ // new Vector2(rects[i].xMin, rects[i].yMax),
|
|
|
+ // new Vector2(rects[i].xMax, rects[i].yMax),
|
|
|
+ // new Vector2(rects[i].xMax, rects[i].yMin),
|
|
|
+ // new Vector2(rects[i].xMin, rects[i].yMin),
|
|
|
+ // };
|
|
|
+
|
|
|
+ // SpriteAsset.SpriteInfoDic.Add(spriteInfoList[i].Name, spriteInfoList[i]);
|
|
|
+ //}
|
|
|
+
|
|
|
+ //AnnounceSpite = sprite;
|
|
|
+ //IsAnnounceReady = true;
|
|
|
|
|
|
if (Initializer.Inited)
|
|
|
{
|