Commit 03f0c66b authored by 神楽坂玲奈's avatar 神楽坂玲奈

code reformat

parent 59f44e6e
using UnityEngine;
using System;
using System.IO;
using System.IO;
using UnityEngine;
public class BackGroundPic : Servant
{
GameObject backGround;
private GameObject backGround;
public override void initialize()
{
backGround = create(Program.I().mod_simple_ngui_background_texture, Vector3.zero, Vector3.zero, false, Program.ui_back_ground_2d);
FileStream file = new FileStream("texture/common/desk.jpg", FileMode.Open, FileAccess.Read);
backGround = create(Program.I().mod_simple_ngui_background_texture, Vector3.zero, Vector3.zero, false,
Program.ui_back_ground_2d);
var file = new FileStream("texture/common/desk.jpg", FileMode.Open, FileAccess.Read);
file.Seek(0, SeekOrigin.Begin);
byte[] data = new byte[file.Length];
file.Read(data, 0, (int)file.Length);
var data = new byte[file.Length];
file.Read(data, 0, (int) file.Length);
file.Close();
file.Dispose();
file = null;
Texture2D pic = new Texture2D(1024, 600);
var pic = new Texture2D(1024, 600);
pic.LoadImage(data);
backGround.GetComponent<UITexture>().mainTexture = pic;
backGround.GetComponent<UITexture>().depth = -100;
......@@ -22,19 +24,20 @@ public class BackGroundPic : Servant
public override void applyShowArrangement()
{
UIRoot root = Program.ui_back_ground_2d.GetComponent<UIRoot>();
float s = (float)root.activeHeight / Screen.height;
var root = Program.ui_back_ground_2d.GetComponent<UIRoot>();
var s = (float) root.activeHeight / Screen.height;
var tex = backGround.GetComponent<UITexture>().mainTexture;
float ss = (float)tex.height / (float)tex.width;
int width = (int)(Screen.width * s);
int height = (int)(width * ss);
var ss = tex.height / (float) tex.width;
var width = (int) (Screen.width * s);
var height = (int) (width * ss);
if (height < Screen.height)
{
height = (int)(Screen.height * s);
width = (int)(height / ss);
height = (int) (Screen.height * s);
width = (int) (height / ss);
}
backGround.GetComponent<UITexture>().height = height+2;
backGround.GetComponent<UITexture>().width = width+2;
backGround.GetComponent<UITexture>().height = height + 2;
backGround.GetComponent<UITexture>().width = width + 2;
}
public override void applyHideArrangement()
......
using UnityEngine;
using System;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
using YGOSharp.OCGWrapper.Enums;
public class Book : WindowServant2D
{
string kacha = "";
string changcha = "";
string xuecha = "";
private string changcha = "";
public string deckString = "";
private string kacha = "";
public UILabel lab = null;
public UILabel labop = null;
private readonly List<string> lines = new List<string>();
public string opString = "";
private lazyBookbtns texts;
private string xuecha = "";
lazyBookbtns texts;
public override void initialize()
{
kacha = InterString.Get("卡差:");
......@@ -24,21 +31,14 @@ public class Book : WindowServant2D
applyHideArrangement();
}
string formatS(string from, int c,bool k)
{
string returnValue = "";
if (k)
private string formatS(string from, int c, bool k)
{
return from + c.ToString();
}
var returnValue = "";
if (k) return @from + c;
if (c < 0)
{
returnValue = from + "[ff0000]" + c.ToString() + "[-]";
}
returnValue = @from + "[ff0000]" + c + "[-]";
else
{
returnValue = from + "[00ff00]" + c.ToString() + "[-]";
}
returnValue = @from + "[00ff00]" + c + "[-]";
return returnValue;
}
......@@ -47,26 +47,22 @@ public class Book : WindowServant2D
base.preFrameFunction();
if (isShowed)
{
gameObject.transform.position = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Program.I().cardDescription.width / 2, (Screen.height-Program.I().cardDescription.cHeight) / 2, 0));
texts.back.width = (int)Program.I().cardDescription.width;
texts.back.height = Screen.height - (int)Program.I().cardDescription.cHeight;
gameObject.transform.position = Program.camera_main_2d.ScreenToWorldPoint(
new Vector3(Program.I().cardDescription.width / 2,
(Screen.height - Program.I().cardDescription.cHeight) / 2, 0));
texts.back.width = (int) Program.I().cardDescription.width;
texts.back.height = Screen.height - (int) Program.I().cardDescription.cHeight;
}
}
public override void applyShowArrangement()
{
if (gameObject != null)
{
gameObject.SetActive(true);
}
if (gameObject != null) gameObject.SetActive(true);
}
public override void applyHideArrangement()
{
if (gameObject != null)
{
gameObject.SetActive(false);
}
if (gameObject != null) gameObject.SetActive(false);
}
public override void hide()
......@@ -84,151 +80,91 @@ public class Book : WindowServant2D
fixScreenProblem();
realize();
}
public UILabel lab = null;
public UILabel labop = null;
public string deckString = "";
public string opString = "";
public void realize()
{
MultiStringMaster master;
if (lab!=null)
if (lab != null)
{
deckString = "";
master = new MultiStringMaster();
foreach (var item in TcpHelper.deckStrings)
{
master.Add(item);
}
foreach (var item in TcpHelper.deckStrings) master.Add(item);
foreach (var item in Program.I().ocgcore.cards)
{
if (item.p.location == (UInt32)CardLocation.Search)
{
continue;
}
if (item.p.location == (UInt32)CardLocation.Unknown)
{
continue;
}
if (item.p.location == (UInt32)CardLocation.Deck)
{
continue;
}
if (item.get_data().Id <= 0)
{
continue;
}
if (item.controllerBased == 0)
{
master.remove(item.get_data().Name);
}
if (item.p.location == (uint) CardLocation.Search) continue;
if (item.p.location == (uint) CardLocation.Unknown) continue;
if (item.p.location == (uint) CardLocation.Deck) continue;
if (item.get_data().Id <= 0) continue;
if (item.controllerBased == 0) master.remove(item.get_data().Name);
}
deckString += master.managedString.TrimEnd('\n');
lab.text = deckString;
}
if (labop != null)
{
opString = "";
master = new MultiStringMaster();
foreach (var item in Program.I().ocgcore.cards)
{
if (item.p.location == (UInt32)CardLocation.Search)
{
continue;
}
if (item.get_data().Id <= 0)
{
continue;
}
if (item.controllerBased == 1)
{
master.Add(item.get_data().Name);
}
if (item.p.location == (uint) CardLocation.Search) continue;
if (item.get_data().Id <= 0) continue;
if (item.controllerBased == 1) master.Add(item.get_data().Name);
}
opString += master.managedString.TrimEnd('\n');
if (Program.I().ocgcore.cantCheckGrave)
{
labop.text = InterString.Get("不能查看对手使用过的卡");
}
else if (master.strings.Count > 0)
{
labop.text = InterString.Get("[ff5555]对手使用过:@n[?][-]", opString);
}
else
{
labop.text = InterString.Get("请等待对手出牌来获取情报");
}
}
if (isShowed == false)
{
return;
}
if (isShowed == false) return;
int[] fieldCards = new int[2] { 0, 0 };
int[] handCards = new int[2] { 0, 0 };
int[] resourceCards = new int[2] { 0, 0 };
bool died = false;
var fieldCards = new int[2] {0, 0};
var handCards = new int[2] {0, 0};
var resourceCards = new int[2] {0, 0};
var died = false;
foreach (var item in Program.I().ocgcore.cards)
{
if (item.p.location == (UInt32)CardLocation.Search)
{
continue;
}
if (item.p.location == (UInt32)CardLocation.Unknown)
{
continue;
}
for (int i = 0; i < 2; i++)
{
if (item.p.location == (uint) CardLocation.Search) continue;
if (item.p.location == (uint) CardLocation.Unknown) continue;
for (var i = 0; i < 2; i++)
if (item.p.controller == i)
{
if (item.p.location == (UInt32)CardLocation.MonsterZone || item.p.location == (UInt32)CardLocation.SpellZone)
{
fieldCards[i]++;
}
if (item.p.location == (UInt32)CardLocation.Hand)
{
handCards[i]++;
}
if (item.p.location == (UInt32)CardLocation.Grave || item.p.location == (UInt32)CardLocation.Removed)
{
if (item.p.location == (uint) CardLocation.MonsterZone ||
item.p.location == (uint) CardLocation.SpellZone) fieldCards[i]++;
if (item.p.location == (uint) CardLocation.Hand) handCards[i]++;
if (item.p.location == (uint) CardLocation.Grave || item.p.location == (uint) CardLocation.Removed)
resourceCards[i]++;
}
}
}
}
if (!died)
{
texts.lable.text =InterString.Get("消息记录")+"\n"+
formatS(kacha, (fieldCards[0] + handCards[0]) - (fieldCards[1] + handCards[1]), false) + " " +
formatS(changcha, (fieldCards[0]) - (fieldCards[1]), false) + " " +
if (!died)
texts.lable.text = InterString.Get("消息记录") + "\n" +
formatS(kacha, fieldCards[0] + handCards[0] - (fieldCards[1] + handCards[1]), false) +
" " +
formatS(changcha, fieldCards[0] - fieldCards[1], false) + " " +
formatS(xuecha,
Program.I().ocgcore.gameInfo.swaped
?
Program.I().ocgcore.life_1 - Program.I().ocgcore.life_0
:
Program.I().ocgcore.life_0 - Program.I().ocgcore.life_1
? Program.I().ocgcore.life_1 - Program.I().ocgcore.life_0
: Program.I().ocgcore.life_0 - Program.I().ocgcore.life_1
, false);
}
string all = "";
foreach (var item in lines)
{
all += item + "\n";
}
var all = "";
foreach (var item in lines) all += item + "\n";
try
{
all = all.Substring(0, all.Length - 1);
}
catch (System.Exception e)
catch (Exception e)
{
}
try
{
texts.textlist.Clear();
......@@ -240,8 +176,6 @@ public class Book : WindowServant2D
}
}
List<string> lines = new List<string>();
public void add(string str)
{
lines.Add(str);
......@@ -253,5 +187,4 @@ public class Book : WindowServant2D
lines.Clear();
realize();
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public static class Config
{
public static uint ClientVersion = 0x1352;
class oneString
{
public string original = "";
public string translated = "";
}
private static readonly List<oneString> translations = new List<oneString>();
static List<oneString> translations = new List<oneString>();
private static readonly List<oneString> uits = new List<oneString>();
static List<oneString> uits = new List<oneString>();
private static string path;
static string path;
private static bool loaded;
public static bool getEffectON(string raw)
{
......@@ -25,18 +23,15 @@ public static class Config
public static void initialize(string path)
{
Config.path = path;
if (File.Exists(path) == false)
{
File.Create(path).Close();
}
string txtString = File.ReadAllText(path);
string[] lines = txtString.Replace("\r", "").Split("\n");
for (int i = 0; i < lines.Length; i++)
if (File.Exists(path) == false) File.Create(path).Close();
var txtString = File.ReadAllText(path);
var lines = txtString.Replace("\r", "").Split("\n");
for (var i = 0; i < lines.Length; i++)
{
string[] mats = lines[i].Split("->");
var mats = lines[i].Split("->");
if (mats.Length == 2)
{
oneString s = new oneString();
var s = new oneString();
s.original = mats[0];
s.translated = mats[1];
translations.Add(s);
......@@ -44,107 +39,102 @@ public static class Config
}
}
static bool loaded = false;
public static string Getui(string original)
{
if (loaded == false)
{
loaded = true;
string[] lines = File.ReadAllText("texture/ui/config.txt").Replace("\r", "").Replace(" ", "").Split("\n");
for (int i = 0; i < lines.Length; i++)
var lines = File.ReadAllText("texture/ui/config.txt").Replace("\r", "").Replace(" ", "").Split("\n");
for (var i = 0; i < lines.Length; i++)
{
string[] mats = lines[i].Split("=");
var mats = lines[i].Split("=");
if (mats.Length == 2)
{
oneString s = new oneString();
var s = new oneString();
s.original = mats[0];
s.translated = mats[1];
uits.Add(s);
}
}
}
string return_value = "";
for (int i = 0; i < uits.Count; i++)
{
var return_value = "";
for (var i = 0; i < uits.Count; i++)
if (uits[i].original == original)
{
return_value = uits[i].translated;
break;
}
}
return return_value;
}
internal static float getFloat(string v)
{
int getted = 0;
var getted = 0;
try
{
getted = Int32.Parse(Get(v, "0"));
getted = int.Parse(Get(v, "0"));
}
catch (Exception)
{
}
return ((float)getted) / 100000f;
return getted / 100000f;
}
internal static void setFloat(string v,float f)
internal static void setFloat(string v, float f)
{
Set(v,((int)(f* 100000f)).ToString());
Set(v, ((int) (f * 100000f)).ToString());
}
public static string Get(string original,string defau)
{
string return_value = defau;
bool finded = false;
for (int i = 0; i < translations.Count; i++)
public static string Get(string original, string defau)
{
var return_value = defau;
var finded = false;
for (var i = 0; i < translations.Count; i++)
if (translations[i].original == original)
{
return_value = translations[i].translated;
finded = true;
break;
}
}
if (finded == false)
{
if (path != null)
{
File.AppendAllText(path, original + "->" + defau + "\r\n");
oneString s = new oneString();
var s = new oneString();
s.original = original;
s.translated = defau;
return_value = defau;
translations.Add(s);
}
}
return return_value;
}
public static void Set(string original,string setted)
{
bool finded = false;
for (int i = 0; i < translations.Count; i++)
public static void Set(string original, string setted)
{
var finded = false;
for (var i = 0; i < translations.Count; i++)
if (translations[i].original == original)
{
finded = true;
translations[i].translated = setted;
}
}
if (finded == false)
{
oneString s = new oneString();
var s = new oneString();
s.original = original;
s.translated = setted;
translations.Add(s);
}
string all = "";
for (int i = 0; i < translations.Count; i++)
{
var all = "";
for (var i = 0; i < translations.Count; i++)
all += translations[i].original + "->" + translations[i].translated + "\r\n";
}
try
{
File.WriteAllText(path, all);
......@@ -152,7 +142,13 @@ public static class Config
catch (Exception e)
{
Program.noAccess = true;
UnityEngine.Debug.Log(e);
Debug.Log(e);
}
}
private class oneString
{
public string original = "";
public string translated = "";
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
public static class InterString
{
static Dictionary<string, string> translations = new Dictionary<string, string>();
private static readonly Dictionary<string, string> translations = new Dictionary<string, string>();
static string path;
private static string path;
public static bool loaded = false;
public static bool loaded;
public static void initialize(string path)
{
InterString.path = path;
if (File.Exists(path) == false)
{
File.Create(path).Close();
}
string txtString = File.ReadAllText(path);
string[] lines = txtString.Replace("\r", "").Split("\n");
for (int i = 0; i < lines.Length; i++)
if (File.Exists(path) == false) File.Create(path).Close();
var txtString = File.ReadAllText(path);
var lines = txtString.Replace("\r", "").Split("\n");
for (var i = 0; i < lines.Length; i++)
{
string[] mats = lines[i].Split("->");
var mats = lines[i].Split("->");
if (mats.Length == 2)
{
if (!translations.ContainsKey(mats[0]))
{
translations.Add(mats[0], mats[1]);
}
}
}
GameStringHelper.xilie = Get("系列:");
GameStringHelper.opHint = Get("*控制权经过转移");
GameStringHelper.licechuwai= Get("*里侧表示的除外卡片");
GameStringHelper.licechuwai = Get("*里侧表示的除外卡片");
GameStringHelper.biaoceewai = Get("*表侧表示的额外卡片");
GameStringHelper.teshuzhaohuan= Get("*被特殊召唤出场");
GameStringHelper.teshuzhaohuan = Get("*被特殊召唤出场");
GameStringHelper.yijingqueren = Get("卡片展示简表※ ");
GameStringHelper._chaoliang = Get("超量:");
GameStringHelper._ewaikazu = Get("额外卡组:");
......@@ -59,13 +53,11 @@ public static class InterString
public static string Get(string original)
{
string return_value = original;
var return_value = original;
if (translations.TryGetValue(original, out return_value))
{
return return_value.Replace("@n", "\r\n").Replace("@ui", "");
}
else if (original != "")
if (original != "")
{
try
{
......@@ -75,10 +67,11 @@ public static class InterString
{
Program.noAccess = true;
}
translations.Add(original, original);
return original.Replace("@n", "\r\n").Replace("@ui", "");
}
else
return original;
}
......@@ -86,5 +79,4 @@ public static class InterString
{
return Get(original).Replace("[?]", replace);
}
}
\ No newline at end of file
This diff is collapsed.
using UnityEngine;
using System;
using System;
using UnityEngine;
public class MonoDelegate : MonoBehaviour
{
public Action actionInMono;
public void function()
{
if (actionInMono != null) actionInMono();
......@@ -14,9 +15,10 @@ public class MonoDelegate : MonoBehaviour
public class MonoListener : MonoBehaviour
{
public Action<GameObject> actionInMono;
public void function()
{
if (actionInMono != null) actionInMono(this.gameObject);
if (actionInMono != null) actionInMono(gameObject);
}
}
......@@ -24,16 +26,17 @@ public class MonoListenerRMS_ized : MonoBehaviour
{
public Action<GameObject, Servant.messageSystemValue> actionInMono;
public Servant.messageSystemValue value;
public void function()
{
UIInput input = GetComponent<UIInput>();
var input = GetComponent<UIInput>();
if (input != null)
{
value = new Servant.messageSystemValue();
value.hint = input.name;
value.value = input.value;
}
if (actionInMono != null) actionInMono(this.gameObject, value);
if (actionInMono != null) actionInMono(gameObject, value);
}
}
\ No newline at end of file
This diff is collapsed.
using System;
using UnityEngine;
using UnityEngine;
public class TextMaster
{
GameObject gameObject;
private readonly GameObject gameObject;
public TextMaster(string hint, Vector3 position, bool isWorld)
{
......@@ -25,13 +23,13 @@ public class TextMaster
{
gameObject = Program.I().ocgcore.create_s(
Program.I().mod_simple_ngui_text,
(Program.camera_main_2d.ScreenToWorldPoint(position)),
Program.camera_main_2d.ScreenToWorldPoint(position),
new Vector3(0, 0, 0),
true,
Program.ui_main_2d,
true
Program.ui_main_2d
);
}
UIHelper.trySetLableText(gameObject, hint);
}
......@@ -39,5 +37,4 @@ public class TextMaster
{
Program.I().ocgcore.destroy(gameObject, 0.6f, true);
}
}
\ No newline at end of file
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.Collections.Generic;
public class MultiStringMaster
{
public class part
{
public string str;
public int count;
}
public string managedString = "";
public List<part> strings = new List<part>();
public string managedString = "";
public void Add(string str)
{
bool exist = false;
for (int i = 0; i < strings.Count; i++)
{
var exist = false;
for (var i = 0; i < strings.Count; i++)
if (strings[i].str == str)
{
exist = true;
strings[i].count++;
}
}
if (exist == false)
{
part t = new part();
var t = new part();
t.count = 1;
t.str = str;
strings.Add(t);
}
managedString = "";
for (int i = 0; i < strings.Count; i++)
{
for (var i = 0; i < strings.Count; i++)
if (strings[i].count == 1)
{
managedString += strings[i].str + "\n";
}
else
{
managedString += strings[i].str + "*" + strings[i].count.ToString() + "\n";
}
}
managedString += strings[i].str + "*" + strings[i].count + "\n";
}
public void clear()
......@@ -54,36 +41,28 @@ public class MultiStringMaster
public void remove(string str)
{
part t = null;
for (int i = 0; i < strings.Count; i++)
{
for (var i = 0; i < strings.Count; i++)
if (strings[i].str.Replace(str, "miaowu") != strings[i].str)
{
t = strings[i];
}
}
if (t != null)
{
if (t.count == 1)
{
strings.Remove(t);
}
else
{
t.count--;
}
}
managedString = "";
for (int i = 0; i < strings.Count; i++)
{
for (var i = 0; i < strings.Count; i++)
if (strings[i].count == 1)
{
managedString += strings[i].str + "\n";
}
else
{
managedString += strings[i].str + "*" + strings[i].count.ToString() + "\n";
}
}
managedString += strings[i].str + "*" + strings[i].count + "\n";
}
public class part
{
public int count;
public string str;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
public class OCGobject
{
public List<GameObject> allObjects = new List<GameObject>();
public GameObject gameObject;
public List<GameObject> allObjects=new List<GameObject>();
public GameObject create(
GameObject mod,
Vector3 position = default(Vector3),
Vector3 rotation = default(Vector3),
Vector3 position = default,
Vector3 rotation = default,
bool fade = false,
GameObject father = null,
bool allParamsInWorld = true,
Vector3 wantScale = default(Vector3)
Vector3 wantScale = default
)
{
GameObject g = Program.I().ocgcore.create_s(mod, position, rotation, fade, father, allParamsInWorld, wantScale);
var g = Program.I().ocgcore.create_s(mod, position, rotation, fade, father, allParamsInWorld, wantScale);
allObjects.Add(g);
return g;
}
......@@ -28,5 +26,4 @@ public class OCGobject
allObjects.Remove(obj);
Program.I().ocgcore.destroy(obj, time, fade, instantNull);
}
}
\ No newline at end of file
using System;
using UnityEngine;
using UnityEngine;
public class gameButton : OCGobject
{
public GameObject gameObjectEvent;
public gameCard cookieCard;
public int response;
public string cookieString;
public GameObject gameObjectEvent;
public string hint;
public superButtonType type;
public string cookieString;
public bool notCookie;
public gameCard cookieCard;
public int response;
public superButtonType type;
public gameButton(int response, string hint, superButtonType type)
{
......@@ -30,18 +28,22 @@ public class gameButton : OCGobject
{
if (gameObject == null)
{
gameObject = create(Program.I().new_ui_superButton, Program.camera_main_2d.ScreenToWorldPoint(v), Vector3.zero, false, Program.ui_main_2d, true);
gameObject = create(Program.I().new_ui_superButton, Program.camera_main_2d.ScreenToWorldPoint(v),
Vector3.zero, false, Program.ui_main_2d);
gameObjectEvent = UIHelper.getRealEventGameObject(gameObject);
UIHelper.registEvent(gameObject, clicked);
gameObject.GetComponent<iconSetForButton>().setTexture(type);
gameObject.GetComponent<iconSetForButton>().setText(hint);
gameObject.transform.localScale = Vector3.zero;
iTween.ScaleTo(gameObject, new Vector3(0.7f * (float)Screen.height / 700f, 0.7f * (float)Screen.height / 700f, 0.7f * (float)Screen.height / 700f), 0.2f);
iTween.ScaleTo(gameObject,
new Vector3(0.7f * Screen.height / 700f, 0.7f * Screen.height / 700f, 0.7f * Screen.height / 700f),
0.2f);
}
gameObject.transform.position = Program.camera_main_2d.ScreenToWorldPoint(v);
}
void clicked()
private void clicked()
{
Program.I().ocgcore.ES_gameButtonClicked(this);
}
......@@ -52,5 +54,4 @@ public class gameButton : OCGobject
gameObject = null;
gameObjectEvent = null;
}
}
\ No newline at end of file
using System;
using UnityEngine;
public class mod : OCGobject
public class mod : OCGobject
{
public mod()
{
......@@ -15,6 +12,5 @@ public class mod : OCGobject
public void Update()
{
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
using System;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using YGOSharp;
public static class GameStringManager
{
public class hashedString
{
public string region = "";
public int hashCode = 0;
public string content = "";
}
public static List<hashedString> hashedStrings = new List<hashedString>();
public static List<hashedString> xilies = new List<hashedString>();
public static int helper_stringToInt(string str)
{
int return_value = 0;
var return_value = 0;
try
{
if (str.Length > 2 && str.Substring(0, 2) == "0x")
{
return_value = Convert.ToInt32(str, 16);
}
else
{
return_value = Int32.Parse(str);
}
return_value = int.Parse(str);
}
catch (Exception)
{
}
return return_value;
}
public static void initialize(string path)
{
string text = System.IO.File.ReadAllText(path);
var text = File.ReadAllText(path);
initializeContent(text);
}
public static void initializeContent(string text)
{
string st = text.Replace("\r", "");
string[] lines = st.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
{
var st = text.Replace("\r", "");
var lines = st.Split(new[] {"\n"}, StringSplitOptions.RemoveEmptyEntries);
foreach (var line in lines)
if (line.Length > 1 && line.Substring(0, 1) == "!")
{
string[] mats = line.Substring(1, line.Length - 1).Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
var mats = line.Substring(1, line.Length - 1).Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries);
if (mats.Length > 2)
{
hashedString a = new hashedString();
var a = new hashedString();
a.region = mats[0];
try
{
......@@ -61,20 +52,14 @@ public static class GameStringManager
{
Program.DEBUGLOG(e);
}
a.content = "";
for (int i = 2; i < mats.Length; i++)
{
a.content += mats[i] + " ";
}
for (var i = 2; i < mats.Length; i++) a.content += mats[i] + " ";
a.content = a.content.Substring(0, a.content.Length - 1);
if (get(a.region, a.hashCode) == "")
{
hashedStrings.Add(a);
if (a.region == "setname")
{
xilies.Add(a);
}
}
if (a.region == "setname") xilies.Add(a);
}
}
}
......@@ -82,52 +67,51 @@ public static class GameStringManager
public static string get(string region, int hashCode)
{
string re = "";
foreach (hashedString s in hashedStrings)
{
var re = "";
foreach (var s in hashedStrings)
if (s.region == region && s.hashCode == hashCode)
{
re = s.content;
break;
}
}
return re;
}
internal static string get_unsafe(int hashCode)
{
string re = "";
foreach (hashedString s in hashedStrings)
{
var re = "";
foreach (var s in hashedStrings)
if (s.region == "system" && s.hashCode == hashCode)
{
re = s.content;
break;
}
}
return re;
}
internal static string get(int description)
{
string a = "";
var a = "";
if (description < 10000)
{
a = get("system", (int)description);
a = get("system", description);
}
else
{
int code = description >> 4;
int index = description & 0xf;
var code = description >> 4;
var index = description & 0xf;
try
{
a = YGOSharp.CardsManager.Get(code).Str[index];
a = CardsManager.Get(code).Str[index];
}
catch (Exception e)
{
Program.DEBUGLOG(e);
}
}
return a;
}
......@@ -137,23 +121,29 @@ public static class GameStringManager
{
if (sequence < 5)
return get(1003);
else if (sequence == 5)
if (sequence == 5)
return get(1008);
else
return get(1009);
}
uint filter = 1;
int i = 1000;
var i = 1000;
for (; filter != 0x100 && filter != location; filter <<= 1)
++i;
if (filter == location)
return get(i);
else
return "???";
}
internal static string formatLocation(GPS gps)
{
return formatLocation(gps.location, gps.sequence);
}
}
public class hashedString
{
public string content = "";
public int hashCode;
public string region = "";
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using UnityEngine;
using System.Collections.Generic;
using Ionic.Zip;
public static class GameZipManager
{
public static List<ZipFile> Zips = new List<ZipFile>();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
using System;
using UnityEngine;
using UnityEngine;
public class ServantWithCardDescription : Servant
{
public override void show()
......@@ -24,10 +24,8 @@ public class ServantWithCardDescription : Servant
public override void preFrameFunction()
{
var des = Program.I().cardDescription;
if (Program.pointedGameObject!= Program.I().cardDescription.description.gameObject)
{
if (Program.pointedGameObject != Program.I().cardDescription.description.gameObject)
des.description.OnScroll(Program.wheelValue / 50f);
}
des.onResized();
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -66,3 +66,4 @@
// return re;
// }
//}
This diff is collapsed.
This diff is collapsed.
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