Commit 4694efba authored by hex's avatar hex

set default resolution to 1600x900

parent b8b5d27a
Pipeline #37628 failed
using UnityEngine; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
public class CardDescription : Servant public class CardDescription : Servant
...@@ -20,14 +20,13 @@ public class CardDescription : Servant ...@@ -20,14 +20,13 @@ public class CardDescription : Servant
public override void initialize() public override void initialize()
{ {
gameObject = create gameObject = create(
(
Program.I().new_ui_cardDescription, Program.I().new_ui_cardDescription,
Program.camera_main_2d.ScreenToWorldPoint(new Vector3(-256, Screen.height /2, 600)), Program.camera_main_2d.ScreenToWorldPoint(new Vector3(-256, Screen.height / 2, 600)),
new Vector3(0, 0, 0), new Vector3(0, 0, 0),
true, true,
Program.ui_back_ground_2d Program.ui_back_ground_2d
); );
picLoader = gameObject.AddComponent<cardPicLoader>(); picLoader = gameObject.AddComponent<cardPicLoader>();
picLoader.code = 0; picLoader.code = 0;
picLoader.uiTexture = UIHelper.getByName<UITexture>(gameObject, "pic_"); picLoader.uiTexture = UIHelper.getByName<UITexture>(gameObject, "pic_");
...@@ -39,19 +38,17 @@ public class CardDescription : Servant ...@@ -39,19 +38,17 @@ public class CardDescription : Servant
monitor = UIHelper.getByName<UIPanel>(gameObject, "monitor"); monitor = UIHelper.getByName<UIPanel>(gameObject, "monitor");
deckPanel = gameObject.GetComponentInChildren<UIDeckPanel>(); deckPanel = gameObject.GetComponentInChildren<UIDeckPanel>();
line = UIHelper.getByName(gameObject, "line"); line = UIHelper.getByName(gameObject, "line");
UIHelper.registEvent(gameObject,"pre_", onPre); UIHelper.registEvent(gameObject, "pre_", onPre);
UIHelper.registEvent(gameObject, "next_", onNext); UIHelper.registEvent(gameObject, "next_", onNext);
UIHelper.registEvent(gameObject, "big_", onb); UIHelper.registEvent(gameObject, "big_", onb);
UIHelper.registEvent(gameObject, "small_", ons); UIHelper.registEvent(gameObject, "small_", ons);
picSprite = UIHelper.getByName<UITexture>(gameObject, "pic_"); picSprite = UIHelper.getByName<UITexture>(gameObject, "pic_");
lineSprite = UIHelper.getByName<UISprite>(gameObject, "line"); lineSprite = UIHelper.getByName<UISprite>(gameObject, "line");
try try
{ {
description.textLabel.fontSize = int.Parse(Config.Get("fontSize","24")); description.textLabel.fontSize = int.Parse(Config.Get("fontSize", "24"));
}
catch (System.Exception e)
{
} }
catch (System.Exception e) { }
read(); read();
myGraveStr = InterString.Get("我方墓地:"); myGraveStr = InterString.Get("我方墓地:");
myExtraStr = InterString.Get("我方额外:"); myExtraStr = InterString.Get("我方额外:");
...@@ -103,7 +100,13 @@ public class CardDescription : Servant ...@@ -103,7 +100,13 @@ public class CardDescription : Servant
if (gameObject != null) if (gameObject != null)
{ {
underSprite.height = Screen.height + 4; underSprite.height = Screen.height + 4;
iTween.MoveTo(gameObject, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(-underSprite.width-20, Screen.height / 2, 0)), 1.2f); iTween.MoveTo(
gameObject,
Program.camera_main_2d.ScreenToWorldPoint(
new Vector3(-underSprite.width - 20, Screen.height / 2, 0)
),
1.2f
);
setTitle(""); setTitle("");
resizer.gameObject.GetComponent<BoxCollider>().enabled = false; resizer.gameObject.GetComponent<BoxCollider>().enabled = false;
} }
...@@ -114,7 +117,11 @@ public class CardDescription : Servant ...@@ -114,7 +117,11 @@ public class CardDescription : Servant
if (gameObject != null) if (gameObject != null)
{ {
underSprite.height = Screen.height + 4; underSprite.height = Screen.height + 4;
iTween.MoveTo(gameObject, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(-2, Screen.height / 2, 0)), 1.2f); iTween.MoveTo(
gameObject,
Program.camera_main_2d.ScreenToWorldPoint(new Vector3(-2, Screen.height / 2, 0)),
1.2f
);
resizer.gameObject.GetComponent<BoxCollider>().enabled = true; resizer.gameObject.GetComponent<BoxCollider>().enabled = true;
} }
} }
...@@ -132,11 +139,9 @@ public class CardDescription : Servant ...@@ -132,11 +139,9 @@ public class CardDescription : Servant
ca = (int)(cb * 0.68) + 50; ca = (int)(cb * 0.68) + 50;
} }
underSprite.width = ca; underSprite.width = ca;
picSprite.height = cb; picSprite.height = cb;
}
catch (System.Exception e)
{
} }
catch (System.Exception e) { }
} }
public void save() public void save()
...@@ -176,7 +181,7 @@ public class CardDescription : Servant ...@@ -176,7 +181,7 @@ public class CardDescription : Servant
YGOSharp.Card currentCard = null; YGOSharp.Card currentCard = null;
public bool ifShowingThisCard(YGOSharp.Card card) public bool ifShowingThisCard(YGOSharp.Card card)
{ {
return currentCard == card; return currentCard == card;
} }
...@@ -210,7 +215,13 @@ public class CardDescription : Servant ...@@ -210,7 +215,13 @@ public class CardDescription : Servant
picLoader.loaded_code = -1; picLoader.loaded_code = -1;
currentCard = card; currentCard = card;
shiftCardShower(true); shiftCardShower(true);
Program.go(50, () => { shiftCardShower(true); }); Program.go(
50,
() =>
{
shiftCardShower(true);
}
);
} }
public void shiftCardShower(bool show) public void shiftCardShower(bool show)
...@@ -244,7 +255,6 @@ public class CardDescription : Servant ...@@ -244,7 +255,6 @@ public class CardDescription : Servant
string opExtraStr = ""; string opExtraStr = "";
string opBanishedStr = ""; string opBanishedStr = "";
public void realizeMonitor() public void realizeMonitor()
{ {
if (monitor.gameObject.activeInHierarchy) if (monitor.gameObject.activeInHierarchy)
...@@ -322,14 +332,18 @@ public class CardDescription : Servant ...@@ -322,14 +332,18 @@ public class CardDescription : Servant
int eachLine = 0; int eachLine = 0;
float monitorHeight = 0; float monitorHeight = 0;
void handleMonitorArea(List<gameCard> list,string hint) void handleMonitorArea(List<gameCard> list, string hint)
{ {
if (list.Count > 0) if (list.Count > 0)
{ {
deckPanel.labs[currentLabelIndex].gameObject.SetActive(true); deckPanel.labs[currentLabelIndex].gameObject.SetActive(true);
deckPanel.labs[currentLabelIndex].text = hint; deckPanel.labs[currentLabelIndex].text = hint;
deckPanel.labs[currentLabelIndex].width = (int)(monitor.width - 12); deckPanel.labs[currentLabelIndex].width = (int)(monitor.width - 12);
deckPanel.labs[currentLabelIndex].transform.localPosition = new Vector3(monitor.width / 2, (monitor.height - 8) / 2 - 12 - currentHeight, 0); deckPanel.labs[currentLabelIndex].transform.localPosition = new Vector3(
monitor.width / 2,
(monitor.height - 8) / 2 - 12 - currentHeight,
0
);
currentLabelIndex++; currentLabelIndex++;
currentHeight += 24; currentHeight += 24;
float beginX = 6 + 22; float beginX = 6 + 22;
...@@ -339,7 +353,11 @@ public class CardDescription : Servant ...@@ -339,7 +353,11 @@ public class CardDescription : Servant
{ {
var gp = UIHelper.get_hang_lie(i, eachLine); var gp = UIHelper.get_hang_lie(i, eachLine);
quickCards[currentCardIndex].reCode(list[i].get_data().Id); quickCards[currentCardIndex].reCode(list[i].get_data().Id);
quickCards[currentCardIndex].transform.localPosition = new Vector3(beginX + 44 * gp.y, beginY - 60 * gp.x, 0); quickCards[currentCardIndex].transform.localPosition = new Vector3(
beginX + 44 * gp.y,
beginY - 60 * gp.x,
0
);
currentCardIndex++; currentCardIndex++;
} }
int hangshu = list.Count / eachLine; int hangshu = list.Count / eachLine;
...@@ -351,7 +369,7 @@ public class CardDescription : Servant ...@@ -351,7 +369,7 @@ public class CardDescription : Servant
currentHeight += 60 * hangshu; currentHeight += 60 * hangshu;
} }
} }
public void onResized() public void onResized()
{ {
if (monitor.gameObject.activeInHierarchy) if (monitor.gameObject.activeInHierarchy)
...@@ -366,9 +384,9 @@ public class CardDescription : Servant ...@@ -366,9 +384,9 @@ public class CardDescription : Servant
} }
} }
public void setData(YGOSharp.Card card, Texture2D def, string tail = "",bool force=false) public void setData(YGOSharp.Card card, Texture2D def, string tail = "", bool force = false)
{ {
if (cardShowerWidget.alpha == 0&&force==false) if (cardShowerWidget.alpha == 0 && force == false)
{ {
return; return;
} }
...@@ -378,7 +396,7 @@ public class CardDescription : Servant ...@@ -378,7 +396,7 @@ public class CardDescription : Servant
} }
if (card.Id == 0) if (card.Id == 0)
{ {
apply(card,def,tail); apply(card, def, tail);
return; return;
} }
if (datas.Count > 0) if (datas.Count > 0)
...@@ -389,7 +407,7 @@ public class CardDescription : Servant ...@@ -389,7 +407,7 @@ public class CardDescription : Servant
{ {
card = card, card = card,
def = def, def = def,
tail = tail tail = tail,
}; };
if (datas.Count > 300) if (datas.Count > 300)
{ {
...@@ -400,13 +418,15 @@ public class CardDescription : Servant ...@@ -400,13 +418,15 @@ public class CardDescription : Servant
return; return;
} }
} }
datas.Add(new data datas.Add(
{ new data
card = card, {
def = def, card = card,
tail = tail def = def,
}); tail = tail,
if (datas.Count>300) }
);
if (datas.Count > 300)
{ {
datas.RemoveAt(0); datas.RemoveAt(0);
} }
...@@ -416,7 +436,7 @@ public class CardDescription : Servant ...@@ -416,7 +436,7 @@ public class CardDescription : Servant
public void setTitle(string title) public void setTitle(string title)
{ {
UIHelper.trySetLableText(gameObject,"title_",title); UIHelper.trySetLableText(gameObject, "title_", title);
} }
List<string> Logs = new List<string>(); List<string> Logs = new List<string>();
...@@ -442,7 +462,7 @@ public class CardDescription : Servant ...@@ -442,7 +462,7 @@ public class CardDescription : Servant
void clearOneLog() void clearOneLog()
{ {
if (Logs.Count>0) if (Logs.Count > 0)
{ {
Logs.RemoveAt(0); Logs.RemoveAt(0);
string all = ""; string all = "";
...@@ -454,17 +474,15 @@ public class CardDescription : Servant ...@@ -454,17 +474,15 @@ public class CardDescription : Servant
{ {
all = all.Substring(0, all.Length - 1); all = all.Substring(0, all.Length - 1);
} }
catch (System.Exception e) catch (System.Exception e) { }
{
}
UIHelper.trySetLableTextList(UIHelper.getByName(gameObject, "chat_"), all); UIHelper.trySetLableTextList(UIHelper.getByName(gameObject, "chat_"), all);
} }
else else
{ {
UIHelper.trySetLableTextList(UIHelper.getByName(gameObject, "chat_"), ""); UIHelper.trySetLableTextList(UIHelper.getByName(gameObject, "chat_"), "");
} }
} }
public void clearAllLog() public void clearAllLog()
{ {
Program.notGo(clearOneLog); Program.notGo(clearOneLog);
......
...@@ -51,7 +51,6 @@ public class UnityFileDownloader ...@@ -51,7 +51,6 @@ public class UnityFileDownloader
File.Delete(filePath); File.Delete(filePath);
} }
File.Move(tempFilePath, filePath); File.Move(tempFilePath, filePath);
// 使用 string.Format 替换了插值字符串
Debug.Log(string.Format("下载成功: {0} -> {1}", url, filePath)); Debug.Log(string.Format("下载成功: {0} -> {1}", url, filePath));
if (onComplete != null) if (onComplete != null)
...@@ -61,7 +60,6 @@ public class UnityFileDownloader ...@@ -61,7 +60,6 @@ public class UnityFileDownloader
} }
else else
{ {
// 使用 string.Format 替换了插值字符串
Debug.LogError(string.Format("下载失败: {0}\n错误信息: {1}", url, uwr.error)); Debug.LogError(string.Format("下载失败: {0}\n错误信息: {1}", url, uwr.error));
if (File.Exists(tempFilePath)) if (File.Exists(tempFilePath))
{ {
......
This diff is collapsed.
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