Commit e1aa4010 authored by hex's avatar hex

fix and optimized

parent 72ddde14
Pipeline #39840 failed
This diff is collapsed.
......@@ -2432,31 +2432,31 @@ public class gameCard : OCGobject
{
Texture2D tex = GameTextureManager.get(data.Id, GameTextureType.card_picture);
Texture2D texc = GameTextureManager.get(data.Id, GameTextureType.card_feature);
if (tex != null)
if (tex == null)
{
if (texc != null)
{
float k = GameTextureManager.getK(data.Id, GameTextureType.card_feature);
refreshFunctions.Remove(SOH_act);
YGO1superShower shower = create(
Program.I().Pro1_superCardShowerA,
Program.I().ocgcore.centre(true),
Vector3.zero,
false,
Program.I().ui_main_2d,
true
)
.GetComponent<YGO1superShower>();
shower.card.mainTexture = tex;
shower.closeup.mainTexture = texc;
shower.closeup.height = (int)(500f / k);
shower.closeup.width = (int)(
(500f / k) * ((float)texc.width) / ((float)texc.height)
);
Ocgcore.LRCgo = shower.gameObject;
destroy(shower.gameObject, 0.7f, false, true);
}
return;
}
if (texc == null)
{
return;
}
// float k = GameTextureManager.getK(data.Id, GameTextureType.card_feature);
refreshFunctions.Remove(SOH_act);
YGO1superShower shower = create(
Program.I().Pro1_superCardShowerA,
Program.I().ocgcore.centre(true),
Vector3.zero,
false,
Program.I().ui_main_2d,
true
)
.GetComponent<YGO1superShower>();
shower.card.mainTexture = tex;
shower.closeup.mainTexture = texc;
shower.closeup.height = 360;
shower.closeup.width = (int)(360 * shower.closeup.mainTexture.width / shower.closeup.mainTexture.height);
Ocgcore.LRCgo = shower.gameObject;
destroy(shower.gameObject, 0.7f, false, true);
}
private void SOH_nAct()
......@@ -2493,31 +2493,33 @@ public class gameCard : OCGobject
{
Texture2D tex = GameTextureManager.get(data.Id, GameTextureType.card_picture);
Texture2D texc = GameTextureManager.get(data.Id, GameTextureType.card_feature);
if (tex != null)
if (tex == null)
{
if (texc != null)
{
float k = GameTextureManager.getK(data.Id, GameTextureType.card_feature);
refreshFunctions.Remove(SOH_sum);
YGO1superShower shower = create(
Program.I().Pro1_superCardShower,
Program.I().ocgcore.centre(true),
Vector3.zero,
false,
Program.I().ui_main_2d,
true
)
.GetComponent<YGO1superShower>();
shower.card.mainTexture = tex;
shower.closeup.mainTexture = texc;
shower.closeup.height = (int)(500f / k);
shower.closeup.width = (int)(
(500f / k) * ((float)texc.width) / ((float)texc.height)
);
Ocgcore.LRCgo = shower.gameObject;
destroy(shower.gameObject, 2f, false, true);
}
return;
}
if (texc == null)
{
return;
}
// float k = GameTextureManager.getK(data.Id, GameTextureType.card_feature);
refreshFunctions.Remove(SOH_sum);
YGO1superShower shower = create(
Program.I().Pro1_superCardShower,
Program.I().ocgcore.centre(true),
Vector3.zero,
false,
Program.I().ui_main_2d,
true
)
.GetComponent<YGO1superShower>();
shower.card.mainTexture = tex;
shower.closeup.mainTexture = texc;
shower.closeup.height = 360;
shower.closeup.width = (int)(360 * shower.closeup.mainTexture.width / shower.closeup.mainTexture.height);
Ocgcore.LRCgo = shower.gameObject;
destroy(shower.gameObject, 2f, false, true);
}
private void SOH_nSum()
......
......@@ -235,7 +235,7 @@ public class GameField : OCGobject
if (File.Exists(texturePath))
{
Texture2D textureField = UIHelper.getTexture2D(texturePath);
Texture2D[] textureFieldSliced = UIHelper.sliceField(textureField);
Texture2D[] textureFieldSliced = UIHelper.SliceField(textureField);
SetFieldTextures(textureFieldSliced);
}
else
......
......@@ -271,8 +271,6 @@ public class GameTextureManager
private static string FindImagePath(PictureResource pic)
{
// ... (原代码中的路径查找逻辑,这里可以保持或优化)
// 为了清晰,我把它提取成了一个独立方法
string path = "";
switch (pic.type)
{
......
......@@ -91,15 +91,16 @@ public class selectDeck : WindowServantSP
{
if (((DeckManager)Program.I().deckManager).deckDirty)
{
RMSshow_yesOrNoOrCancle(
"deckManager_returnAction"
, InterString.Get("要保存卡组的变更吗?")
, new messageSystemValue { hint = "yes", value = "yes" }
, new messageSystemValue { hint = "no", value = "no" }
, new messageSystemValue { hint = "cancle", value = "cancle" }
);
RMSshow_yesOrNoOrCancle(
"deckManager_returnAction"
, InterString.Get("要保存卡组的变更吗?")
, new messageSystemValue { hint = "yes", value = "yes" }
, new messageSystemValue { hint = "no", value = "no" }
, new messageSystemValue { hint = "cancle", value = "cancle" }
);
}
else {
else
{
Program.I().shiftToServant(Program.I().selectDeck);
}
};
......@@ -183,11 +184,12 @@ public class selectDeck : WindowServantSP
}
if (hashCode == "onCode")
{
if(result[0].value != "") {
if (result[0].value != "")
{
try
{
YGOSharp.Deck deck;
if(!DeckManager.FromBase64toCodedDeck(result[0].value, out deck))
if (!DeckManager.FromBase64toCodedDeck(result[0].value, out deck))
{
RMSshow_none(InterString.Get("卡组代码无效。"));
return;
......@@ -285,23 +287,23 @@ public class selectDeck : WindowServantSP
string path = "deck/" + superScrollView.selectedString + ".ydk";
if (File.Exists(path))
{
/*
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
System.Diagnostics.Process.Start("notepad.exe", path);
#elif UNITY_STANDALONE_OSX //Mac OS X
System.Diagnostics.Process.Start("open", "-e " + path);
#elif UNITY_STANDALONE_LINUX //Linux
System.Diagnostics.Process.Start("gedit", path);
#elif UNITY_ANDROID //Android
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
jo.Call("openFile", Program.ANDROID_GAME_PATH + path);
//#elif UNITY_IPHONE //iPhone
#endif
*/
/*
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
System.Diagnostics.Process.Start("notepad.exe", path);
#elif UNITY_STANDALONE_OSX //Mac OS X
System.Diagnostics.Process.Start("open", "-e " + path);
#elif UNITY_STANDALONE_LINUX //Linux
System.Diagnostics.Process.Start("gedit", path);
#elif UNITY_ANDROID //Android
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
jo.Call("openFile", Program.ANDROID_GAME_PATH + path);
//#elif UNITY_IPHONE //iPhone
#endif
*/
YGOSharp.Deck deck;
DeckManager.FromYDKtoCodedDeck(path, out deck);
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);
else
default_string = "";
......@@ -311,7 +313,7 @@ public class selectDeck : WindowServantSP
private void setSortLable()
{
if (Config.Get(sort,"1") == "1")
if (Config.Get(sort, "1") == "1")
{
UIHelper.trySetLableText(gameObject, "sort_", InterString.Get("时间排序"));
}
......@@ -323,7 +325,7 @@ public class selectDeck : WindowServantSP
private void onSort()
{
if (Config.Get(sort,"1") == "1")
if (Config.Get(sort, "1") == "1")
{
Config.Set(sort, "0");
}
......@@ -367,7 +369,7 @@ public class selectDeck : WindowServantSP
int extraXyz = 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)
{
mainAll++;
......@@ -388,7 +390,7 @@ public class selectDeck : WindowServantSP
Vector2 v = UIHelper.get_hang_lieArry(mainAll - 1, hangshu);
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
,
......@@ -418,7 +420,7 @@ public class selectDeck : WindowServantSP
quickCards[currentIndex].reCode(item);
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
,
......@@ -478,7 +480,7 @@ public class selectDeck : WindowServantSP
deckPanel.leftMain.text = GameStringHelper._zhukazu + mainAll;
deckPanel.leftExtra.text = GameStringHelper._ewaikazu + extraAll;
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.rightSide.text = GameStringHelper._guaishou + sideMonster + " " + GameStringHelper._mofa + sideSpell + " " + GameStringHelper._xianjing + sideTrap;
}
......@@ -502,15 +504,15 @@ public class selectDeck : WindowServantSP
Config.Set("deckInUse", superScrollView.selectedString);
}
}
base.hide();
base.hide();
}
void printFile()
{
string deckInUse = Config.Get("deckInUse","miaowu");
string deckInUse = Config.Get("deckInUse", "miaowu");
superScrollView.clear();
FileInfo[] fileInfos = (new DirectoryInfo("deck")).GetFiles();
if (Config.Get(sort,"1") == "1")
if (Config.Get(sort, "1") == "1")
{
Array.Sort(fileInfos, UIHelper.CompareTime);
}
......
......@@ -293,6 +293,7 @@ public class Servant
public void SetBar(GameObject mod, float buttomToScreen, float RightToScreen)
{
// Debug.Log("SetBar buttomToScreen: " + buttomToScreen);
this.buttomToScreen = buttomToScreen;
this.RightToScreen = RightToScreen;
if (toolBar != null)
......
......@@ -2111,7 +2111,7 @@ public class DeckManager : ServantWithCardDescription
// 根据区域决定动画的交错延迟
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++)
{
......@@ -2214,7 +2214,7 @@ public class DeckManager : ServantWithCardDescription
void ShowObjectDeck()
{
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++)
{
Vector2 v = UIHelper.get_hang_lieArry(i, hangshu);
......@@ -2332,11 +2332,13 @@ public class DeckManager : ServantWithCardDescription
Program.go(500, superScrollView.toTop);
if (side)
{
UIInput_search.enabled = false;
UIInput_search.value = InterString.Get("对手使用过的卡↓");
UIInput_search.isSelected = false;
}
else
{
UIInput_search.enabled = true;
UIInput_search.value = "";
UIInput_search.isSelected = false;
}
......
......@@ -25,7 +25,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 125240}
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_ConstrainProportionsScale: 0
m_Children:
......@@ -4966,7 +4966,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 137080}
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_ConstrainProportionsScale: 0
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