Commit a78608ab authored by Unicorn369's avatar Unicorn369

Synchronized updates

parent a6c4c4c5
......@@ -33,6 +33,7 @@ sysinfo.txt
# Builds
*.apk
*.unitypackage
Library_
Temp/
ygopro.jks
AI_core_vs2017solution/bin/
......@@ -51,6 +52,7 @@ replay/
sound/
texture/
textures/
update/
updates/
cards.cdb
lflist.conf
......
......@@ -12,7 +12,8 @@ public class LAZYsetting : MonoBehaviour {
public UIToggle closeUp;
public UIToggle showoff;
public UIToggle showoffWhenActived;
public UIToggle cloud;
public UIToggle cloud;
public UIToggle DownloadImage;
public UIToggle Vbattle;
public UIToggle Vmove;
public UIToggle Vchain;
......
fileFormatVersion: 2
guid: 2873b6ac782d78642be2ec304b530cc2
timeCreated: 1551513021
licenseType: Free
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Android: Android
second:
enabled: 1
settings: {}
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
......@@ -21,6 +21,8 @@ public class Menu : WindowServantSP
UIHelper.registEvent(gameObject, "single_", onClickPizzle);
//UIHelper.registEvent(gameObject, "ai_", onClickAI);
UIHelper.registEvent(gameObject, "exit_", onClickExit);
UIHelper.registEvent(gameObject, "joinQQ_", onClickJoinQQ);
UIHelper.registEvent(gameObject, "download_", onClickDownload);
//(new Thread(up)).Start();
}
......@@ -126,6 +128,31 @@ public class Menu : WindowServantSP
Program.I().shiftToServant(Program.I().selectDeck);
}
void onClickJoinQQ()
{
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
Application.OpenURL("https://jq.qq.com/?_wv=1027&k=50MZVQA");
#elif UNITY_ANDROID //Android
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
jo.Call("doJoinQQGroup", "UHm3h3hSrmgp-iYqMiZcc2zO5J1Q8OyW");
#endif
}
void onClickDownload()
{
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
Application.OpenURL("https://github.com/Unicorn369/pro2_android_closeup/releases/download/1.0/closeup_version1.0.zip");
#elif UNITY_ANDROID //Android
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
if (!File.Exists("updates/closeup_version1.0.txt"))//用于检查更新
{
jo.Call("doDownloadZipFile", "https://github.com/Unicorn369/pro2_android_closeup/releases/download/1.0/closeup_version1.0.zip");//下载并解压
} else {
jo.Call("showToast", "已下载,无需再次下载!");
}
#endif
}
public static void deleteShell()
{
try
......
......@@ -15,6 +15,7 @@ public static class TcpHelper
static NetworkStream networkStream = null;
static bool canjoin = true;
static bool roomListChecking = false;
public static void join(string ipString, string name, string portString, string pswString, string version)
{
......@@ -30,6 +31,14 @@ public static class TcpHelper
Thread t = new Thread(receiver);
t.Start();
CtosMessage_PlayerInfo(name);
if (pswString == "L")
{
roomListChecking = true;
}
else
{
roomListChecking = false;
}
CtosMessage_JoinGame(pswString, version);
}
catch (Exception e)
......@@ -163,6 +172,9 @@ public static class TcpHelper
case YGOSharp.Network.Enums.StocMessage.HsWatchChange:
((Room)Program.I().room).StocMessage_HsWatchChange(r);
break;
case YGOSharp.Network.Enums.StocMessage.RoomList:
((Room)Program.I().room).StocMessage_RoomList(r);
break;
default:
break;
}
......@@ -196,7 +208,10 @@ public static class TcpHelper
{
Program.I().shiftToServant(Program.I().selectServer);
}
Program.I().cardDescription.RMSshow_none(InterString.Get("链接被断开。"));
if (!roomListChecking)
{
Program.I().cardDescription.RMSshow_none(InterString.Get("链接被断开。"));
}
}
else
{
......
......@@ -87,6 +87,7 @@ public class Program : MonoBehaviour
public GameObject new_ui_setting;
public GameObject new_ui_book;
public GameObject new_ui_selectServer;
public GameObject new_ui_RoomList;
public GameObject new_ui_gameInfo;
public GameObject new_ui_cardDescription;
public GameObject new_ui_search;
......@@ -287,7 +288,7 @@ public class Program : MonoBehaviour
//YGOPro2 Paths (https://github.com/Unicorn369/YGOPro2_Droid/tree/Test)
string GamePaths = "/storage/emulated/0/ygopro2/";
if(!File.Exists(GamePaths + "updates/version1.0.txt"))
if (!File.Exists(GamePaths + "updates/version1.0.txt"))
{
string filePath = Application.streamingAssetsPath + "/ygocore.zip";
var www = new WWW(filePath);
......@@ -300,7 +301,7 @@ public class Program : MonoBehaviour
System.IO.Directory.SetCurrentDirectory(GamePaths);
#elif UNITY_IPHONE //iPhone
string GamePaths = Application.persistentDataPath + "/ygopro2/";
if(!File.Exists(GamePaths + "updates/version1.0.txt"))
if (!File.Exists(GamePaths + "updates/version1.0.txt"))
{
string filePath = Application.streamingAssetsPath + "/ygocore.zip";
var www = new WWW(filePath);
......@@ -323,8 +324,7 @@ public class Program : MonoBehaviour
go(300, () =>
{
//UpdateClient();
InterString.initialize("config/translation.conf");
//InterString.initialize("config" + AppLanguage.LanguageDir() + "/translation.conf"); //System Language
InterString.initialize("config" + AppLanguage.LanguageDir() + "/translation.conf"); //System Language
GameTextureManager.initialize();
Config.initialize("config/config.conf");
GameStringManager.initialize("config/strings.conf");
......@@ -338,33 +338,28 @@ public class Program : MonoBehaviour
}
YGOSharp.BanlistManager.initialize("config/lflist.conf");
FileInfo[] fileInfos = (new DirectoryInfo("cdb")).GetFiles().OrderByDescending(x => x.Name).ToArray();
//FileInfo[] fileInfos = (new DirectoryInfo("cdb" + AppLanguage.LanguageDir())).GetFiles().OrderByDescending(x => x.Name).ToArray();//System Language
FileInfo[] fileInfos = (new DirectoryInfo("cdb" + AppLanguage.LanguageDir())).GetFiles().OrderByDescending(x => x.Name).ToArray();//System Language
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Name.Length > 4)
{
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb")
{
YGOSharp.CardsManager.initialize("cdb/" + fileInfos[i].Name);
//YGOSharp.CardsManager.initialize("cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);//System Language
YGOSharp.CardsManager.initialize("cdb" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);//System Language
}
}
}
if (Directory.Exists("expansions"))
//if (Directory.Exists("expansions" + AppLanguage.LanguageDir()))//System Language
if (Directory.Exists("expansions" + AppLanguage.LanguageDir()))//System Language
{
fileInfos = (new DirectoryInfo("expansions")).GetFiles().OrderByDescending(x => x.Name).ToArray();
//fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles().OrderByDescending(x => x.Name).ToArray();//System Language
fileInfos = (new DirectoryInfo("expansions" + AppLanguage.LanguageDir())).GetFiles().OrderByDescending(x => x.Name).ToArray();//System Language
for (int i = 0; i < fileInfos.Length; i++)
{
if (fileInfos[i].Name.Length > 4)
{
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb")
{
YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name);
//YGOSharp.CardsManager.initialize("expansions" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);
YGOSharp.CardsManager.initialize("expansions" + AppLanguage.LanguageDir() + "/" + fileInfos[i].Name);
}
}
}
......@@ -388,6 +383,17 @@ public class Program : MonoBehaviour
initializeALLservants();
loadResources();
#if UNITY_ANDROID //Android Java Test
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
if (!File.Exists("updates/image_version1.0.txt"))//用于检查更新
{
if (File.Exists("pics.zip"))//YGOMobile内置的卡图包
{
jo.Call("doExtractZipFile", "pics.zip", "./");
File.Create("updates/image_version1.0.txt");
}
}
#endif
});
}
......@@ -441,11 +447,10 @@ public class Program : MonoBehaviour
{
try
{
WWW w = new WWW("https://api.github.com/repos/szefo09/updateYGOPro2/contents/");
while (!w.isDone)
{
if (Application.internetReachability == NetworkReachability.NotReachable)
if (Application.internetReachability == NetworkReachability.NotReachable || !string.IsNullOrEmpty(w.error))
{
throw new Exception("No Internet connection!");
}
......@@ -457,22 +462,22 @@ public class Program : MonoBehaviour
Directory.CreateDirectory("updates");
toDownload.AddRange(apiFromGit);
}
if (File.Exists("updates/SHAs.txt"))
{
List<ApiFile> local = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<List<ApiFile>>(File.ReadAllText("updates/SHAs.txt"));
foreach(ApiFile file in apiFromGit)
foreach (ApiFile file in apiFromGit)
{
if(file.sha != local.FirstOrDefault(x => x.name == file.name).sha)
if (local.FirstOrDefault(x => x.name == file.name)==null || file.sha != local.FirstOrDefault(x => x.name == file.name).sha)
{
toDownload.Add(file);
}
}
foreach(ApiFile f in local)
foreach (ApiFile f in local)
{
if(f.name != apiFromGit.FirstOrDefault(x => x.name == f.name).name)
if (apiFromGit.FirstOrDefault(x => x.name == f.name) == null || f.name != apiFromGit.FirstOrDefault(x => x.name == f.name).name)
{
if (File.Exists("cdb/"+f.name))
if (File.Exists("cdb/" + f.name))
{
File.Delete("cdb/" + f.name);
}
......@@ -487,7 +492,7 @@ public class Program : MonoBehaviour
HttpDldFile httpDldFile = new HttpDldFile();
foreach (var dl in toDownload)
{
if (Path.GetExtension(dl.name)== ".cdb" && !(Application.internetReachability == NetworkReachability.NotReachable))
if (Path.GetExtension(dl.name) == ".cdb" && !(Application.internetReachability == NetworkReachability.NotReachable))
{
httpDldFile.Download(dl.download_url, Path.Combine("cdb/", dl.name));
}
......@@ -500,7 +505,7 @@ public class Program : MonoBehaviour
}
catch (Exception e)
{
Debug.Log(e.ToString());
File.Delete("updates/SHAs.txt");
}
}
......@@ -885,6 +890,7 @@ public class Program : MonoBehaviour
public DeckManager deckManager;
public Ocgcore ocgcore;
public SelectServer selectServer;
public RoomList roomList;
public Book book;
public puzzleMode puzzleMode;
public AIRoom aiRoom;
......@@ -906,6 +912,8 @@ public class Program : MonoBehaviour
servants.Add(ocgcore);
selectServer = new SelectServer();
servants.Add(selectServer);
roomList = new RoomList();
servants.Add(roomList);
book = new Book();
servants.Add(book);
selectReplay = new selectReplay();
......@@ -962,6 +970,10 @@ public class Program : MonoBehaviour
{
aiRoom.hide();
}
if(to != roomList && to != selectServer && roomList.isShowed)
{
roomList.hide();
}
if (to == backGroundPic && backGroundPic.isShowed == false) backGroundPic.show();
if (to == menu && menu.isShowed == false) menu.show();
......@@ -974,6 +986,7 @@ public class Program : MonoBehaviour
if (to == selectReplay && selectReplay.isShowed == false) selectReplay.show();
if (to == puzzleMode && puzzleMode.isShowed == false) puzzleMode.show();
if (to == aiRoom && aiRoom.isShowed == false) aiRoom.show();
if (to == roomList && !roomList.isShowed) roomList.show();
}
......@@ -1110,6 +1123,7 @@ public class Program : MonoBehaviour
public static bool Running = true;
public static bool MonsterCloud = false;
public static bool DownloadImage = false;
public static float fieldSize = 1;
void OnApplicationQuit()
......
......@@ -808,25 +808,17 @@ public class GameTextureManager
{
path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
}
#if UNITY_ANDROID || UNITY_IPHONE //Android、iPhone
if (!File.Exists(path) && pic.code != 0)
if (!File.Exists(path) && pic.code != 0 && Program.DownloadImage)
{
//YGOMobile (177x254)
df.Download("http://android.ygopro.win/YGOMobile/pics/" + pic.code.ToString() + ".jpg", "expansions/pics/" + pic.code.ToString() + ".jpg");
df.Download("http://download.ygopro.win/ygopro/pics/" + pic.code.ToString() + ".jpg", "expansions/pics/" + pic.code.ToString() + ".jpg");
path = "expansions/pics/" + pic.code.ToString() + ".jpg";
}
#endif
if (!File.Exists(path) && pic.code != 0)
if (!File.Exists(path) && pic.code != 0 && Program.DownloadImage)
{
//YGOPro2 (421x614)
df.Download("http://update.ygopro.win/ygopro2-data/picture/card/" + pic.code.ToString() + ".jpg", "picture/card/" + pic.code.ToString() + ".jpg");
path = "picture/card/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path) && pic.code != 0)
{
//YGOPro2 pre(336x490)
df.Download("http://update.ygopro.win/ygopro2-data/expansions/pics/" + pic.code.ToString() + ".jpg", "picture/card/" + pic.code.ToString() + ".jpg");
path = "picture/card/" + pic.code.ToString() + ".jpg";
//先行卡 (177x254)
df.Download("http://download.ygopro.win/ygopro2-data/expansions/pics/" + pic.code.ToString() + ".jpg", "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg");
path = "picture/cardIn8thEdition/" + pic.code.ToString() + ".jpg";
}
if (!File.Exists(path))
{
......
......@@ -2,6 +2,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
public class Room : WindowServantSP
{
......@@ -284,6 +286,192 @@ public class Room : WindowServantSP
RMSshow_none(result);
}
public void StocMessage_RoomList(BinaryReader r)
{
//requires a dedicated button and a list to show rooms.
short count = BitConverter.ToInt16(r.ReadBytes(2), 0);
string roomname;
string player1 = "";
string player2 = "";
string hoststr=String.Empty;
List<string[]> roomList = new List<string[]>();
for (ushort i = 0; i < count; i++)
{
List<char> chars = new List<char>();
byte[] temp = r.ReadBytes(64);
roomname = Encoding.UTF8.GetString(temp);
roomname = roomname.Trim(new char[] { '\0' });
int room_status = Convert.ToInt16(BitConverter.ToString(r.ReadBytes(1), 0),16);
int room_duel_count = Convert.ToInt16(BitConverter.ToString(r.ReadBytes(1), 0),16);
int room_turn_count = Convert.ToInt16(BitConverter.ToString(r.ReadBytes(1), 0), 16);
temp = r.ReadBytes(128);
player1 = Encoding.UTF8.GetString(temp);
player1 = player1.Trim(new char[] { '\0' });
int player1_score = Convert.ToInt16(BitConverter.ToString(r.ReadBytes(1), 0));
int player1_lp = BitConverter.ToInt32(r.ReadBytes(4), 0);
temp = r.ReadBytes(128);
player2 = Encoding.UTF8.GetString(temp);
player2 = player2.Trim(new char[] { '\0' });
int player2_score = Convert.ToInt16(BitConverter.ToString(r.ReadBytes(1), 0));
int player2_lp = BitConverter.ToInt32(r.ReadBytes(4), 0);
if (room_status == 0)
{
player1 = player1.Replace("???", " ");
player2 = player2.Replace("???", " ");
}
string roomTag = RoomNameFormatter(roomname);
string[] strings = new string[]
{
room_duel_count.ToString(),
room_turn_count.ToString(),
roomname,
player1_score.ToString(),
player1_lp.ToString(),
player1,
player2,
player2_score.ToString(),
player2_lp.ToString(),
hoststr,
room_status.ToString(),
roomTag
};
switch (room_status)
{
case 0:
{
hoststr = "[EFD334][未开始][FFFFFF] " + strings[11] +"[FFFFFF]"+ strings[5] + " VS " + strings[6];
break;
}
case 1:
{
hoststr = "[A978ED][G:" + strings[0] + ",T:" + strings[1] + "][FFFFFF] " + strings[11] +"[FFFFFF]" + strings[5] + " VS " + strings[6];
break;
}
case 2:
{
hoststr = "[A978ED][G:" + strings[0] + ",Siding][FFFFFF] " + strings[11] + "[FFFFFF]" + strings[5] + " VS " + strings[6];
break;
}
default:
{
hoststr = String.Empty;
break;
}
}
strings[9] = hoststr;
roomList.Add(strings);
}
Program.I().roomList.UpdateList(roomList);
//Do something with the roomList.
}
string RoomNameFormatter(string roomname)
{
string roomTag=String.Empty;
List<string> tags = new List<string>();
if (Regex.IsMatch(roomname, @"^S,RANDOM#\d{1,}"))
{
roomTag = "[8AE57E][Duel] ";
return roomTag;
}
else if(Regex.IsMatch(roomname, @"^M,RANDOM#\d{1,}"))
{
roomTag = "[42C1EC][Match] ";
return roomTag;
}
else if(Regex.IsMatch(roomname, @"^AI#\S{0,},\d{1,}")|| Regex.IsMatch(roomname, @"^AI\S{0,}#\d{1,}"))
{
roomTag = "[5E71FF][AI] ";
return roomTag;
}
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}NF[,#])?(?(1)|(^NF[#,]))"))
{
tags.Add("[C63111][No Banlist] ");
}
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}LF\d[,#])?(?(1)|(^LF\d[#,]))"))
{
int banlist = (int)char.GetNumericValue(roomname[roomname.LastIndexOf("LF") + 2]);
YGOSharp.Banlist blist = YGOSharp.BanlistManager.Banlists[banlist - 1];
tags.Add("[DDDDAA][" + blist.Name + "]");
}
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}OO[,#])?(?(1)|(^OO[#,]))"))
{
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}OT[,#])?(?(1)|(^OT[#,]))"))
{
tags.Add("[11C69C][TCG/OCG]");
}
else
{
tags.Add("[B62FB2][OCG]");
}
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}S[,#])?(?(1)|(^S[#,]))"))
{
tags.Add("[8AE57E][Duel] ");
}
else if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}M[,#])?(?(1)|(^M[#,]))"))
{
tags.Add("[42C1EC][Match] ");
}
else if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}T[,#])?(?(1)|(^T[#,]))"))
{
tags.Add("[D14291][TAG] ");
}
}
else if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}TO[,#])?(?(1)|(^TO[#,]))"))
{
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}OT[,#])?(?(1)|(^OT[#,]))"))
{
tags.Add("[11C69C][TCG/OCG]");
}
else
{
tags.Add("[F58637][TCG]");
}
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}S[,#])?(?(1)|(^S[#,]))"))
{
tags.Add("[8AE57E][Duel] ");
}
else if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}M[,#])?(?(1)|(^M[#,]))"))
{
tags.Add("[42C1EC][Match] ");
}
else if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}T[,#])?(?(1)|(^T[#,]))"))
{
tags.Add("[D14291][TAG] ");
}
}
else
{
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}T[,#])?(?(1)|(^T[#,]))"))
{
tags.Add("[D14291][TAG]");
}
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}M[,#])?(?(1)|(^M[#,]))"))
{
tags.Add("[42C1EC][Match]");
}
if (Regex.IsMatch(roomname, @"(\w{1,}[,^]{1}S[,#])?(?(1)|(^S[#,]))")){
tags.Add("[8AE57E][Duel]");
}
}
roomTag = String.Join("", tags.ToArray())+" ";
if (roomTag == " ")
{
roomTag ="[ "+roomname+" ] ";
}
if (roomTag.Length > 150)
{
roomTag = "[CUSTOM] ";
}
return roomTag;
}
public void StocMessage_Replay(BinaryReader r)
{
byte[] data = r.ReadToEnd();
......
using UnityEngine;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Linq;
public class RoomList : WindowServantSP
{
UIselectableList superScrollView = null;
List<string[]> listOfRooms = new List<string[]>();
bool hideAI;
bool hideStarted;
UILabel roomNameLabel;
public override void initialize()
{
createWindow(Program.I().new_ui_RoomList);
UIHelper.registEvent(gameObject, "exit_", onClickExit);
UIHelper.registEvent(gameObject, "refresh_", onRefresh);
roomNameLabel = UIHelper.getByName<UILabel>(gameObject, "roomNameLabel");
hideAI =UIHelper.getByName<UIToggle>(gameObject, "hideAIrooms_").value = UIHelper.fromStringToBool(Config.Get("hideAIrooms_", "1"));
hideStarted=UIHelper.getByName<UIToggle>(gameObject, "hideStarted_").value = UIHelper.fromStringToBool(Config.Get("hideStarted_", "1"));
UIHelper.registEvent(gameObject, "hideAIrooms_", save);
UIHelper.registEvent(gameObject, "hideStarted_", save);
superScrollView = gameObject.GetComponentInChildren<UIselectableList>();
superScrollView.selectedAction = onSelected;
superScrollView.install();
SetActiveFalse();
}
private void save()
{
hideAI = UIHelper.getByName<UIToggle>(gameObject, "hideAIrooms_").value;
hideStarted = UIHelper.getByName<UIToggle>(gameObject, "hideStarted_").value;
Config.Set("hideAIrooms_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "hideAIrooms_").value));
Config.Set("hideStarted_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "hideStarted_").value));
}
private void onRefresh()
{
Program.I().selectServer.onClickRoomList();
}
public void UpdateList(List<string[]> roomList)
{
show();
listOfRooms.Clear();
listOfRooms.AddRange(roomList);
printFile();
}
public void onClickExit()
{
hide();
}
public override void hide()
{
roomNameLabel.text = "";
base.hide();
}
private void printFile()
{
superScrollView.clear();
superScrollView.toTop();
if (hideAI)
{
listOfRooms.RemoveAll(s => s[11].Contains("AI"));
}
if (hideStarted)
{
listOfRooms.RemoveAll(s => Convert.ToInt32(s[10]) != 0);
}
listOfRooms.TrimExcess();
listOfRooms = listOfRooms.OrderBy(s => s[3]).ToList();
foreach (string[] room in listOfRooms)
{
superScrollView.add(room[9]);
}
//for (int i = 0; i < listOfRooms.Count; i++)
//{
// //if (listOfRooms[i].Length > 4)
// //{
// // //if (/*listOfRooms[i].Substring(fileInfos[i].Name.Length - 4, 4) == ".lua"*/)
// // //{
// // // // superScrollView.add(listOfRooms[i].Substring(0, listOf.Name.Length - 4));
// // //}
// //}
//}
}
string selectedString = string.Empty;
void onSelected()
{
if (!isShowed)
{
return;
}
string roomPsw;
if (selectedString == superScrollView.selectedString)
{
roomPsw= listOfRooms.Find(s => s[9] == selectedString)[2];
JoinRoom(superScrollView.selectedString,roomPsw);
return;
}
selectedString = superScrollView.selectedString;
roomPsw= listOfRooms.Find(s => s[9] == selectedString)[2];
int roomNameIndex = roomPsw.LastIndexOf("#")+1;
if (roomNameIndex > 0)
{
roomNameLabel.text = roomPsw.Substring(roomNameIndex);
}
}
void JoinRoom(string selectedString,string roomPsw)
{
string Name = UIHelper.getByName<UIInput>(Program.I().selectServer.gameObject, "name_").value;
string ipString = UIHelper.getByName<UIInput>(Program.I().selectServer.gameObject, "ip_").value;
string portString = UIHelper.getByName<UIInput>(Program.I().selectServer.gameObject, "port_").value;
string pswString = roomPsw;
string versionString = UIHelper.getByName<UIInput>(Program.I().selectServer.gameObject, "version_").value;
if (versionString == "")
{
UIHelper.getByName<UIInput>(Program.I().selectServer.gameObject, "version_").value = "0x1348";
versionString = "0x1348";
}
Program.I().roomList.hide();
Program.I().selectServer.KF_onlineGame(Name, ipString, portString, versionString, pswString);
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 3dc3c230506cd4f409746edaac651b29
timeCreated: 1551335384
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -241,7 +241,17 @@ 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 (https://github.com/Unicorn369/Unity_Android_Library)
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
jo.Call("openFile", "/storage/emulated/0/ygopro2/" + path);
//#elif UNITY_IPHONE //iPhone
#endif
}
}
......
......@@ -24,7 +24,7 @@ public class Setting : WindowServant2D
UIHelper.getByName<UIToggle>(gameObject, "handmPosition_").value = UIHelper.fromStringToBool(Config.Get("handmPosition_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "spyer_").value = UIHelper.fromStringToBool(Config.Get("spyer_", "1"));
UIHelper.getByName<UIToggle>(gameObject, "resize_").value = UIHelper.fromStringToBool(Config.Get("resize_", "0"));
if (QualitySettings.GetQualityLevel()<3)
if (QualitySettings.GetQualityLevel() < 3)
{
UIHelper.getByName<UIToggle>(gameObject, "high_").value = false;
}
......@@ -46,13 +46,13 @@ public class Setting : WindowServant2D
sliderSize = UIHelper.getByName<UISlider>(gameObject, "size_");
sliderAlpha = UIHelper.getByName<UISlider>(gameObject, "alpha_");
sliderVsize = UIHelper.getByName<UISlider>(gameObject, "vSize_");
Program.go(2000,readVales);
Program.go(2000, readVales);
var collection = gameObject.GetComponentsInChildren<UIToggle>();
for (int i = 0; i < collection.Length; i++)
{
if (collection[i].name.Length > 0 && collection[i].name[0] == '*')
{
if (collection[i].name== "*mouseParticle" || collection[i].name == "*showOff" || collection[i].name == "*Efield")
if (collection[i].name == "*mouseParticle" || collection[i].name == "*showOff" || collection[i].name == "*Efield")
{
collection[i].value = UIHelper.fromStringToBool(Config.Get(collection[i].name, "1"));
}
......@@ -62,13 +62,14 @@ public class Setting : WindowServant2D
}
}
}
setting.showoffATK.value = Config.Get("showoffATK","1800");
setting.showoffATK.value = Config.Get("showoffATK", "1800");
setting.showoffStar.value = Config.Get("showoffStar", "5");
UIHelper.registEvent(setting.showoffATK.gameObject, onchangeClose);
UIHelper.registEvent(setting.showoffStar.gameObject, onchangeClose);
UIHelper.registEvent(setting.mouseEffect.gameObject, onchangeMouse);
UIHelper.registEvent(setting.closeUp.gameObject, onchangeCloseUp);
UIHelper.registEvent(setting.cloud.gameObject, onchangeCloud);
UIHelper.registEvent(setting.cloud.gameObject, onchangeCloud);
UIHelper.registEvent(setting.DownloadImage.gameObject, onchangeDownload);
UIHelper.registEvent(setting.Vpedium.gameObject, onCP);
UIHelper.registEvent(setting.Vfield.gameObject, onCP);
UIHelper.registEvent(setting.Vlink.gameObject, onCP);
......@@ -98,6 +99,11 @@ public class Setting : WindowServant2D
Program.MonsterCloud = setting.cloud.value;
}
public void onchangeDownload()
{
Program.DownloadImage = setting.DownloadImage.value;
}
public void onchangeMouse()
{
Program.I().mouseParticle.SetActive(setting.mouseEffect.value);
......@@ -115,7 +121,7 @@ public class Setting : WindowServant2D
}
public void onchangeCloseUp()
public void onchangeCloseUp()
{
if (setting.closeUp.value == false)
{
......@@ -177,7 +183,7 @@ public class Setting : WindowServant2D
}
UISlider sliderSize;
void onChangeSize()
void onChangeSize()
{
if (sliderSize != null)
{
......@@ -185,7 +191,7 @@ public class Setting : WindowServant2D
}
}
public float vol()
public float vol()
{
return UIHelper.getByName<UISlider>(gameObject, "vol_").value;
}
......@@ -217,7 +223,7 @@ public class Setting : WindowServant2D
Config.Set("vSize_", ((int)(UIHelper.getByName<UISlider>(gameObject, "vSize_").value * 1000)).ToString());
Config.Set("alpha_", ((int)(UIHelper.getByName<UISlider>(gameObject, "alpha_").value * 1000)).ToString());
var collection = gameObject.GetComponentsInChildren<UIToggle>();
for (int i = 0; i < collection.Length; i++)
for (int i = 0; i < collection.Length; i++)
{
if (collection[i].name.Length > 0 && collection[i].name[0] == '*')
{
......@@ -231,7 +237,7 @@ public class Setting : WindowServant2D
public void save()
{
Config.Set("ignoreWatcher_",UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "ignoreWatcher_").value));
Config.Set("ignoreWatcher_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "ignoreWatcher_").value));
Config.Set("ignoreOP_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "ignoreOP_").value));
Config.Set("smartSelect_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "smartSelect_").value));
Config.Set("autoChain_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "autoChain_").value));
......
......@@ -19,6 +19,7 @@ public class SelectServer : WindowServantSP
UIHelper.registEvent(gameObject, "exit_", onClickExit);
UIHelper.registEvent(gameObject, "face_", onClickFace);
UIHelper.registEvent(gameObject, "join_", onClickJoin);
//UIHelper.registEvent(gameObject, "roomList_", onClickRoomList);
UIHelper.getByName<UIInput>(gameObject, "name_").value = Config.Get("name","一秒一喵机会");
list = UIHelper.getByName<UIPopupList>(gameObject, "history_");
UIHelper.registEvent(gameObject,"history_", onSelected);
......@@ -150,6 +151,25 @@ public class SelectServer : WindowServantSP
KF_onlineGame(Name, ipString, portString, versionString, pswString);
}
public void onClickRoomList()
{
if (!isShowed)
{
return;
}
string Name = UIHelper.getByName<UIInput>(gameObject, "name_").value;
string ipString = UIHelper.getByName<UIInput>(gameObject, "ip_").value;
string portString = UIHelper.getByName<UIInput>(gameObject, "port_").value;
string pswString = "L";
string versionString = UIHelper.getByName<UIInput>(gameObject, "version_").value;
if (versionString == "")
{
UIHelper.getByName<UIInput>(gameObject, "version_").value = "0x1348";
versionString = "0x1348";
}
KF_onlineGame(Name, ipString, portString, versionString, pswString);
}
public void KF_onlineGame(string Name,string ipString, string portString, string versionString, string pswString="")
{
name = Name;
......
guid: 7222ecfae3a1484299c43f7272174c56
fileFormatVersion: 2
guid: 7222ecfae3a1484299c43f7272174c56
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
data:
first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
......@@ -25,6 +25,11 @@ namespace YGOSharp
nullString += "\r\n「Android」\r\n[url=https://github.com/Unicorn369/YGOPro2_Droid][u]https://github.com/Unicorn369/YGOPro2_Droid[/u][/url]";
//nullString += "\r\nWindows:[url=https://github.com/lllyasviel/YGOProUnity_V2][u]https://github.com/lllyasviel/YGOProUnity_V2[/u][/url]";
nullString += "\r\n\r\n「Windows」\r\n[url=https://github.com/mercury233/ygopro2][u]https://github.com/mercury233/ygopro2[/u][/url]";
nullString += "\r\n\r\n\r\n";
nullString += "欢迎加入QQ群:";
nullString += "\r\n①:[url=https://jq.qq.com/?_wv=1027&k=5nq6xJe][u]649612818[/u][/url]";
nullString += "\r\n③:[url=https://jq.qq.com/?_wv=1027&k=50MZVQA][u]831010207[/u][/url]";
nullString += "\r\n②:[url=https://jq.qq.com/?_wv=1027&k=5idyod3][u]559276772[/u][/url]";
using (SqliteConnection connection = new SqliteConnection("Data Source=" + databaseFullPath))
{
connection.Open();
......
......@@ -21,6 +21,7 @@
Chat = 0x19,
HsPlayerEnter = 0x20,
HsPlayerChange = 0x21,
HsWatchChange = 0x22
HsWatchChange = 0x22,
RoomList = 0x31
}
}
This diff is collapsed.
......@@ -450,7 +450,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 171500}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2, y: 274, z: 0}
m_LocalPosition: {x: 2, y: 273, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 419752}
......@@ -813,7 +813,7 @@ BoxCollider:
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 20, y: 20, z: 0}
m_Size: {x: 30, y: 30, z: 0}
m_Center: {x: 0, y: 0, z: 0}
--- !u!65 &6550730
BoxCollider:
......@@ -963,7 +963,7 @@ MonoBehaviour:
keepCrispWhenShrunk: 1
mTrueTypeFont: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
mFont: {fileID: 0}
mText: Hide active duels
mText: "\u9690\u85CF\u5F00\u59CB\u7684\u623F\u95F4"
mFontSize: 20
mFontStyle: 0
mAlignment: 0
......@@ -1251,7 +1251,7 @@ MonoBehaviour:
keepCrispWhenShrunk: 1
mTrueTypeFont: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
mFont: {fileID: 0}
mText: Room List
mText: "\u623F\u95F4\u4FE1\u606F"
mFontSize: 30
mFontStyle: 0
mAlignment: 1
......@@ -1417,7 +1417,7 @@ MonoBehaviour:
keepCrispWhenShrunk: 1
mTrueTypeFont: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
mFont: {fileID: 0}
mText: Hide AI rooms
mText: "\u9690\u85CF\u4EBA\u673A\u7684\u623F\u95F4"
mFontSize: 20
mFontStyle: 0
mAlignment: 0
......@@ -1523,24 +1523,24 @@ MonoBehaviour:
leftAnchor:
target: {fileID: 419752}
relative: 1
absolute: -39
absolute: -44
rightAnchor:
target: {fileID: 419752}
relative: 1
absolute: -19
absolute: -14
bottomAnchor:
target: {fileID: 419752}
relative: 1
absolute: -47
absolute: -52
topAnchor:
target: {fileID: 419752}
relative: 1
absolute: -27
absolute: -22
updateAnchors: 1
mColor: {r: 1, g: 1, b: 1, a: 1}
mPivot: 4
mWidth: 20
mHeight: 20
mWidth: 30
mHeight: 30
mDepth: 1
autoResizeBoxCollider: 1
hideIfOffScreen: 0
......@@ -1595,7 +1595,7 @@ MonoBehaviour:
autoResizeBoxCollider: 0
hideIfOffScreen: 0
keepAspectRatio: 0
aspectRatio: 0.9369863
aspectRatio: 0.94
mType: 0
mFillDirection: 4
mFillAmount: 1
......@@ -1762,7 +1762,7 @@ MonoBehaviour:
keepCrispWhenShrunk: 1
mTrueTypeFont: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
mFont: {fileID: 0}
mText: 'Room Name: '
mText: "\u623F\u95F4\u540D\uFF1A"
mFontSize: 25
mFontStyle: 0
mAlignment: 1
......@@ -2240,7 +2240,6 @@ MonoBehaviour:
mod: {fileID: 120608, guid: b102b714e94a8bf4abf4b4ada52e4158, type: 2}
panel: {fileID: 11450640}
scrollBar: {fileID: 11447614}
heightOfEach: 20
preHeight: 0
--- !u!114 &11487676
MonoBehaviour:
......@@ -2408,7 +2407,7 @@ MonoBehaviour:
keepCrispWhenShrunk: 1
mTrueTypeFont: {fileID: 12800000, guid: f775853fdfd14bb47934543e95c3bae3, type: 3}
mFont: {fileID: 0}
mText: Refresh
mText: "\u5237\u65B0\u623F\u95F4"
mFontSize: 20
mFontStyle: 0
mAlignment: 1
......
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