Commit e1aa4010 authored by hex's avatar hex

fix and optimized

parent 72ddde14
Pipeline #39840 failed
This diff is collapsed.
...@@ -2432,11 +2432,15 @@ public class gameCard : OCGobject ...@@ -2432,11 +2432,15 @@ public class gameCard : OCGobject
{ {
Texture2D tex = GameTextureManager.get(data.Id, GameTextureType.card_picture); Texture2D tex = GameTextureManager.get(data.Id, GameTextureType.card_picture);
Texture2D texc = GameTextureManager.get(data.Id, GameTextureType.card_feature); Texture2D texc = GameTextureManager.get(data.Id, GameTextureType.card_feature);
if (tex != null) if (tex == null)
{ {
if (texc != null) return;
}
if (texc == null)
{ {
float k = GameTextureManager.getK(data.Id, GameTextureType.card_feature); return;
}
// float k = GameTextureManager.getK(data.Id, GameTextureType.card_feature);
refreshFunctions.Remove(SOH_act); refreshFunctions.Remove(SOH_act);
YGO1superShower shower = create( YGO1superShower shower = create(
Program.I().Pro1_superCardShowerA, Program.I().Pro1_superCardShowerA,
...@@ -2449,15 +2453,11 @@ public class gameCard : OCGobject ...@@ -2449,15 +2453,11 @@ public class gameCard : OCGobject
.GetComponent<YGO1superShower>(); .GetComponent<YGO1superShower>();
shower.card.mainTexture = tex; shower.card.mainTexture = tex;
shower.closeup.mainTexture = texc; shower.closeup.mainTexture = texc;
shower.closeup.height = (int)(500f / k); shower.closeup.height = 360;
shower.closeup.width = (int)( shower.closeup.width = (int)(360 * shower.closeup.mainTexture.width / shower.closeup.mainTexture.height);
(500f / k) * ((float)texc.width) / ((float)texc.height)
);
Ocgcore.LRCgo = shower.gameObject; Ocgcore.LRCgo = shower.gameObject;
destroy(shower.gameObject, 0.7f, false, true); destroy(shower.gameObject, 0.7f, false, true);
} }
}
}
private void SOH_nAct() private void SOH_nAct()
{ {
...@@ -2493,11 +2493,17 @@ public class gameCard : OCGobject ...@@ -2493,11 +2493,17 @@ public class gameCard : OCGobject
{ {
Texture2D tex = GameTextureManager.get(data.Id, GameTextureType.card_picture); Texture2D tex = GameTextureManager.get(data.Id, GameTextureType.card_picture);
Texture2D texc = GameTextureManager.get(data.Id, GameTextureType.card_feature); Texture2D texc = GameTextureManager.get(data.Id, GameTextureType.card_feature);
if (tex != null) if (tex == null)
{ {
if (texc != null) return;
}
if (texc == null)
{ {
float k = GameTextureManager.getK(data.Id, GameTextureType.card_feature); return;
}
// float k = GameTextureManager.getK(data.Id, GameTextureType.card_feature);
refreshFunctions.Remove(SOH_sum); refreshFunctions.Remove(SOH_sum);
YGO1superShower shower = create( YGO1superShower shower = create(
Program.I().Pro1_superCardShower, Program.I().Pro1_superCardShower,
...@@ -2510,15 +2516,11 @@ public class gameCard : OCGobject ...@@ -2510,15 +2516,11 @@ public class gameCard : OCGobject
.GetComponent<YGO1superShower>(); .GetComponent<YGO1superShower>();
shower.card.mainTexture = tex; shower.card.mainTexture = tex;
shower.closeup.mainTexture = texc; shower.closeup.mainTexture = texc;
shower.closeup.height = (int)(500f / k); shower.closeup.height = 360;
shower.closeup.width = (int)( shower.closeup.width = (int)(360 * shower.closeup.mainTexture.width / shower.closeup.mainTexture.height);
(500f / k) * ((float)texc.width) / ((float)texc.height)
);
Ocgcore.LRCgo = shower.gameObject; Ocgcore.LRCgo = shower.gameObject;
destroy(shower.gameObject, 2f, false, true); destroy(shower.gameObject, 2f, false, true);
} }
}
}
private void SOH_nSum() private void SOH_nSum()
{ {
......
...@@ -235,7 +235,7 @@ public class GameField : OCGobject ...@@ -235,7 +235,7 @@ public class GameField : OCGobject
if (File.Exists(texturePath)) if (File.Exists(texturePath))
{ {
Texture2D textureField = UIHelper.getTexture2D(texturePath); Texture2D textureField = UIHelper.getTexture2D(texturePath);
Texture2D[] textureFieldSliced = UIHelper.sliceField(textureField); Texture2D[] textureFieldSliced = UIHelper.SliceField(textureField);
SetFieldTextures(textureFieldSliced); SetFieldTextures(textureFieldSliced);
} }
else else
......
...@@ -271,8 +271,6 @@ public class GameTextureManager ...@@ -271,8 +271,6 @@ public class GameTextureManager
private static string FindImagePath(PictureResource pic) private static string FindImagePath(PictureResource pic)
{ {
// ... (原代码中的路径查找逻辑,这里可以保持或优化)
// 为了清晰,我把它提取成了一个独立方法
string path = ""; string path = "";
switch (pic.type) switch (pic.type)
{ {
......
...@@ -99,7 +99,8 @@ public class selectDeck : WindowServantSP ...@@ -99,7 +99,8 @@ public class selectDeck : WindowServantSP
, new messageSystemValue { hint = "cancle", value = "cancle" } , new messageSystemValue { hint = "cancle", value = "cancle" }
); );
} }
else { else
{
Program.I().shiftToServant(Program.I().selectDeck); Program.I().shiftToServant(Program.I().selectDeck);
} }
}; };
...@@ -183,11 +184,12 @@ public class selectDeck : WindowServantSP ...@@ -183,11 +184,12 @@ public class selectDeck : WindowServantSP
} }
if (hashCode == "onCode") if (hashCode == "onCode")
{ {
if(result[0].value != "") { if (result[0].value != "")
{
try try
{ {
YGOSharp.Deck deck; YGOSharp.Deck deck;
if(!DeckManager.FromBase64toCodedDeck(result[0].value, out deck)) if (!DeckManager.FromBase64toCodedDeck(result[0].value, out deck))
{ {
RMSshow_none(InterString.Get("卡组代码无效。")); RMSshow_none(InterString.Get("卡组代码无效。"));
return; return;
...@@ -285,23 +287,23 @@ public class selectDeck : WindowServantSP ...@@ -285,23 +287,23 @@ public class selectDeck : WindowServantSP
string path = "deck/" + superScrollView.selectedString + ".ydk"; string path = "deck/" + superScrollView.selectedString + ".ydk";
if (File.Exists(path)) if (File.Exists(path))
{ {
/* /*
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows #if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
System.Diagnostics.Process.Start("notepad.exe", path); System.Diagnostics.Process.Start("notepad.exe", path);
#elif UNITY_STANDALONE_OSX //Mac OS X #elif UNITY_STANDALONE_OSX //Mac OS X
System.Diagnostics.Process.Start("open", "-e " + path); System.Diagnostics.Process.Start("open", "-e " + path);
#elif UNITY_STANDALONE_LINUX //Linux #elif UNITY_STANDALONE_LINUX //Linux
System.Diagnostics.Process.Start("gedit", path); System.Diagnostics.Process.Start("gedit", path);
#elif UNITY_ANDROID //Android #elif UNITY_ANDROID //Android
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API"); AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
jo.Call("openFile", Program.ANDROID_GAME_PATH + path); jo.Call("openFile", Program.ANDROID_GAME_PATH + path);
//#elif UNITY_IPHONE //iPhone //#elif UNITY_IPHONE //iPhone
#endif #endif
*/ */
YGOSharp.Deck deck; YGOSharp.Deck deck;
DeckManager.FromYDKtoCodedDeck(path, out deck); DeckManager.FromYDKtoCodedDeck(path, out deck);
string default_string; string default_string;
if(deck.Main.Count > 0 || deck.Extra.Count > 0 || deck.Side.Count > 0) if (deck.Main.Count > 0 || deck.Extra.Count > 0 || deck.Side.Count > 0)
default_string = DeckManager.convertDeckToBase64(deck); default_string = DeckManager.convertDeckToBase64(deck);
else else
default_string = ""; default_string = "";
...@@ -311,7 +313,7 @@ public class selectDeck : WindowServantSP ...@@ -311,7 +313,7 @@ public class selectDeck : WindowServantSP
private void setSortLable() private void setSortLable()
{ {
if (Config.Get(sort,"1") == "1") if (Config.Get(sort, "1") == "1")
{ {
UIHelper.trySetLableText(gameObject, "sort_", InterString.Get("时间排序")); UIHelper.trySetLableText(gameObject, "sort_", InterString.Get("时间排序"));
} }
...@@ -323,7 +325,7 @@ public class selectDeck : WindowServantSP ...@@ -323,7 +325,7 @@ public class selectDeck : WindowServantSP
private void onSort() private void onSort()
{ {
if (Config.Get(sort,"1") == "1") if (Config.Get(sort, "1") == "1")
{ {
Config.Set(sort, "0"); Config.Set(sort, "0");
} }
...@@ -367,7 +369,7 @@ public class selectDeck : WindowServantSP ...@@ -367,7 +369,7 @@ public class selectDeck : WindowServantSP
int extraXyz = 0; int extraXyz = 0;
int currentIndex = 0; int currentIndex = 0;
int[] hangshu = UIHelper.get_decklieshuArray(deck.Main.Count); int[] hangshu = UIHelper.GetDeckLayoutArray(deck.Main.Count);
foreach (var item in deck.Main) foreach (var item in deck.Main)
{ {
mainAll++; mainAll++;
...@@ -388,7 +390,7 @@ public class selectDeck : WindowServantSP ...@@ -388,7 +390,7 @@ public class selectDeck : WindowServantSP
Vector2 v = UIHelper.get_hang_lieArry(mainAll - 1, hangshu); Vector2 v = UIHelper.get_hang_lieArry(mainAll - 1, hangshu);
quickCards[currentIndex].transform.localPosition = new Vector3 quickCards[currentIndex].transform.localPosition = new Vector3
( (
-176.3f + UIHelper.get_left_right_indexZuo(0, 352f, (int)v.y, hangshu[(int)v.x],10) -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, (int)v.y, hangshu[(int)v.x], 10)
, ,
161.6f - v.x * 60f 161.6f - v.x * 60f
, ,
...@@ -418,7 +420,7 @@ public class selectDeck : WindowServantSP ...@@ -418,7 +420,7 @@ public class selectDeck : WindowServantSP
quickCards[currentIndex].reCode(item); quickCards[currentIndex].reCode(item);
quickCards[currentIndex].transform.localPosition = new Vector3 quickCards[currentIndex].transform.localPosition = new Vector3
( (
-176.3f + UIHelper.get_left_right_indexZuo(0, 352f, sideAll - 1, deck.Side.Count,10) -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, sideAll - 1, deck.Side.Count, 10)
, ,
-181.1f -181.1f
, ,
...@@ -478,7 +480,7 @@ public class selectDeck : WindowServantSP ...@@ -478,7 +480,7 @@ public class selectDeck : WindowServantSP
deckPanel.leftMain.text = GameStringHelper._zhukazu + mainAll; deckPanel.leftMain.text = GameStringHelper._zhukazu + mainAll;
deckPanel.leftExtra.text = GameStringHelper._ewaikazu + extraAll; deckPanel.leftExtra.text = GameStringHelper._ewaikazu + extraAll;
deckPanel.leftSide.text = GameStringHelper._fukazu + sideAll; deckPanel.leftSide.text = GameStringHelper._fukazu + sideAll;
deckPanel.rightMain.text = GameStringHelper._guaishou + mainMonster + " "+ GameStringHelper._mofa + mainSpell + " " + GameStringHelper._xianjing + mainTrap; deckPanel.rightMain.text = GameStringHelper._guaishou + mainMonster + " " + GameStringHelper._mofa + mainSpell + " " + GameStringHelper._xianjing + mainTrap;
deckPanel.rightExtra.text = GameStringHelper._ronghe + extraFusion + " " + GameStringHelper._tongtiao + extraSync + " " + GameStringHelper._chaoliang + extraXyz + " " + GameStringHelper._lianjie + extraLink; deckPanel.rightExtra.text = GameStringHelper._ronghe + extraFusion + " " + GameStringHelper._tongtiao + extraSync + " " + GameStringHelper._chaoliang + extraXyz + " " + GameStringHelper._lianjie + extraLink;
deckPanel.rightSide.text = GameStringHelper._guaishou + sideMonster + " " + GameStringHelper._mofa + sideSpell + " " + GameStringHelper._xianjing + sideTrap; deckPanel.rightSide.text = GameStringHelper._guaishou + sideMonster + " " + GameStringHelper._mofa + sideSpell + " " + GameStringHelper._xianjing + sideTrap;
} }
...@@ -507,10 +509,10 @@ public class selectDeck : WindowServantSP ...@@ -507,10 +509,10 @@ public class selectDeck : WindowServantSP
void printFile() void printFile()
{ {
string deckInUse = Config.Get("deckInUse","miaowu"); string deckInUse = Config.Get("deckInUse", "miaowu");
superScrollView.clear(); superScrollView.clear();
FileInfo[] fileInfos = (new DirectoryInfo("deck")).GetFiles(); FileInfo[] fileInfos = (new DirectoryInfo("deck")).GetFiles();
if (Config.Get(sort,"1") == "1") if (Config.Get(sort, "1") == "1")
{ {
Array.Sort(fileInfos, UIHelper.CompareTime); Array.Sort(fileInfos, UIHelper.CompareTime);
} }
......
...@@ -293,6 +293,7 @@ public class Servant ...@@ -293,6 +293,7 @@ public class Servant
public void SetBar(GameObject mod, float buttomToScreen, float RightToScreen) public void SetBar(GameObject mod, float buttomToScreen, float RightToScreen)
{ {
// Debug.Log("SetBar buttomToScreen: " + buttomToScreen);
this.buttomToScreen = buttomToScreen; this.buttomToScreen = buttomToScreen;
this.RightToScreen = RightToScreen; this.RightToScreen = RightToScreen;
if (toolBar != null) if (toolBar != null)
......
...@@ -2111,7 +2111,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -2111,7 +2111,7 @@ public class DeckManager : ServantWithCardDescription
// 根据区域决定动画的交错延迟 // 根据区域决定动画的交错延迟
float staggerDelay = (zone == CardZone.Main) ? 0.015f : 0.045f; float staggerDelay = (zone == CardZone.Main) ? 0.015f : 0.045f;
int[] hangshu = (zone == CardZone.Main) ? UIHelper.get_decklieshuArray(cardIds.Count) : null; int[] hangshu = (zone == CardZone.Main) ? UIHelper.GetDeckLayoutArray(cardIds.Count) : null;
for (int i = 0; i < cardIds.Count; i++) for (int i = 0; i < cardIds.Count; i++)
{ {
...@@ -2214,7 +2214,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -2214,7 +2214,7 @@ public class DeckManager : ServantWithCardDescription
void ShowObjectDeck() void ShowObjectDeck()
{ {
float k = (float)(1.5 * 0.1 / 0.130733633); float k = (float)(1.5 * 0.1 / 0.130733633);
int[] hangshu = UIHelper.get_decklieshuArray(deck.IMain.Count); int[] hangshu = UIHelper.GetDeckLayoutArray(deck.IMain.Count);
for (int i = 0; i < deck.IMain.Count; i++) for (int i = 0; i < deck.IMain.Count; i++)
{ {
Vector2 v = UIHelper.get_hang_lieArry(i, hangshu); Vector2 v = UIHelper.get_hang_lieArry(i, hangshu);
...@@ -2332,11 +2332,13 @@ public class DeckManager : ServantWithCardDescription ...@@ -2332,11 +2332,13 @@ public class DeckManager : ServantWithCardDescription
Program.go(500, superScrollView.toTop); Program.go(500, superScrollView.toTop);
if (side) if (side)
{ {
UIInput_search.enabled = false;
UIInput_search.value = InterString.Get("对手使用过的卡↓"); UIInput_search.value = InterString.Get("对手使用过的卡↓");
UIInput_search.isSelected = false; UIInput_search.isSelected = false;
} }
else else
{ {
UIInput_search.enabled = true;
UIInput_search.value = ""; UIInput_search.value = "";
UIInput_search.isSelected = false; UIInput_search.isSelected = false;
} }
......
...@@ -25,7 +25,7 @@ Transform: ...@@ -25,7 +25,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 125240} m_GameObject: {fileID: 125240}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.27, y: 0, z: 5.65} m_LocalPosition: {x: -0.32103002, y: 0, z: 6.71785}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
...@@ -4966,7 +4966,7 @@ Transform: ...@@ -4966,7 +4966,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 137080} m_GameObject: {fileID: 137080}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 6.217, y: 0, z: -1.695} m_LocalPosition: {x: -7.89496, y: 0, z: -10.794931}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
......
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