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,23 +24,24 @@ 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()
{
applyShowArrangement();
}
}
}
\ No newline at end of file
This diff is collapsed.
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)
{
......@@ -24,19 +22,16 @@ 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++)
Config.path = path;
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)
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)
public static string Get(string original, string defau)
{
string return_value = defau;
bool finded = false;
for (int i = 0; i < translations.Count; i++)
{
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)
public static void Set(string original, string setted)
{
bool finded = false;
for (int i = 0; i < translations.Count; i++)
{
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,16 +67,16 @@ public static class InterString
{
Program.noAccess = true;
}
translations.Add(original, original);
return original.Replace("@n", "\r\n").Replace("@ui", "");
}
else
return original;
return original;
}
public static string Get(string original, string replace)
{
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,26 +15,28 @@ 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);
}
}
public class MonoListenerRMS_ized : MonoBehaviour
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)
{
......@@ -17,7 +15,7 @@ public class TextMaster
true,
Program.ui_main_3d,
false
);
);
UIHelper.clearITWeen(gameObject);
iTween.ScaleTo(gameObject, new Vector3(0.03f, 0.03f, 0.03f), 0.6f);
}
......@@ -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(
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()
public mod()
{
Program.I().ocgcore.AddUpdateAction_s(Update);
}
......@@ -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.Collections.Generic;
using Ionic.Zip;
public static class GameZipManager
{
public static List<ZipFile> Zips = new List<ZipFile>();
}
}
\ No newline at end of file
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