Commit 0123822f authored by Unicorn369's avatar Unicorn369

Merge branch 'Test' of https://github.com/Unicorn369/YGOPro2_Droid into Android

parents 29591290 3066cb8b
......@@ -5,6 +5,7 @@ using System;
public class MonoCardInDeckManager : MonoBehaviour {
int loadedPicCode = 0;
YGOSharp.Banlist loaded_banlist = null;
public bool dying = false;
bool died = false;
public YGOSharp.Card cardData=new YGOSharp.Card();
......@@ -61,6 +62,7 @@ public class MonoCardInDeckManager : MonoBehaviour {
}
else
{
dying = true;
died = true;
gameObject.SetActive(false);
}
......@@ -96,12 +98,13 @@ public class MonoCardInDeckManager : MonoBehaviour {
{
physicalON();
isDraging = false;
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)||getIfAlive()==false)
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || getIfAlive() == false)
{
Vector3 form_position = getGoodPosition(4);
Vector3 to_position = getGoodPosition(0);
Vector3 delta_position = to_position - form_position;
GetComponent<Rigidbody>().AddForce(delta_position * 200);
GetComponent<Rigidbody>().AddForce(delta_position * 1000);
dying = true;
}
}
......
......@@ -236,7 +236,7 @@ public class UICamera : MonoBehaviour
/// Whether the joystick and controller events will be processed.
/// </summary>
public bool useController = true;
public bool useController = false;
[System.Obsolete("Use new OnDragStart / OnDragOver / OnDragOut / OnDragEnd events instead")]
public bool stickyPress { get { return true; } }
......@@ -372,7 +372,7 @@ public class UICamera : MonoBehaviour
}
}
static bool mDisableController = false;
static bool mDisableController = true;
static Vector2 mLastPos = Vector2.zero;
/// <summary>
......
......@@ -212,7 +212,8 @@ public class SuperScrollView
{
moveFloat = panel.baseClipRegion.y + (panel.GetViewSize().y - heightOfEach) / 2 - 10;
maxFloat = -(heightOfEach * Items.Count - panel.GetViewSize().y + 20);
if (maxFloat > 0)
// 1900x1000 resolution and 11 cards displayed caused this value to reach exactly 0 and crash the game.
if (maxFloat >= 0)
{
maxFloat = -0.001f;
}
......
......@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using UnityEngine;
using YGOSharp.OCGWrapper.Enums;
......@@ -11,31 +12,45 @@ public static class UIHelper
[DllImport("user32")]
static extern bool FlashWindow(IntPtr handle, bool invert);
public delegate bool WNDENUMPROC(IntPtr hwnd, uint lParam);
public delegate bool WNDENUMPROC(IntPtr hwnd, IntPtr lParam);
[DllImport("user32", SetLastError = true)]
static extern bool EnumWindows(WNDENUMPROC lpEnumFunc, uint lParam);
static extern bool EnumWindows(WNDENUMPROC lpEnumFunc, IntPtr lParam);
[DllImport("user32", SetLastError = true)]
static extern IntPtr GetParent(IntPtr hWnd);
[DllImport("user32")]
static extern uint GetWindowThreadProcessId(IntPtr hWnd, ref uint lpdwProcessId);
static extern uint GetWindowThreadProcessId(IntPtr hWnd, ref IntPtr lpdwProcessId);
[DllImport("user32")]
static extern int GetClassNameW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder lpString, int nMaxCount);
[DllImport("user32")]
static extern bool IsZoomed(IntPtr hWnd);
[DllImport("user32")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("kernel32")]
static extern void SetLastError(uint dwErrCode);
static IntPtr myHWND = IntPtr.Zero;
static IntPtr GetProcessWnd()
{
if (myHWND != IntPtr.Zero)
return myHWND;
IntPtr ptrWnd = IntPtr.Zero;
uint pid = (uint)System.Diagnostics.Process.GetCurrentProcess().Id; // 当前进程 ID
IntPtr pid = (IntPtr)System.Diagnostics.Process.GetCurrentProcess().Id; // 当前进程 ID
bool bResult = EnumWindows(new WNDENUMPROC(delegate (IntPtr hwnd, uint lParam)
bool bResult = EnumWindows(new WNDENUMPROC(delegate (IntPtr hwnd, IntPtr mypid)
{
uint id = 0;
IntPtr id = IntPtr.Zero;
if (GetParent(hwnd) == IntPtr.Zero)
StringBuilder ClassName = new StringBuilder(256);
GetClassNameW(hwnd, ClassName, ClassName.Capacity);
if (string.Compare(ClassName.ToString(), "UnityWndClass", true, System.Globalization.CultureInfo.InvariantCulture) == 0)
{
GetWindowThreadProcessId(hwnd, ref id);
if (id == lParam) // 找到进程对应的主窗口句柄
if (id == mypid) // 找到进程对应的主窗口句柄
{
ptrWnd = hwnd; // 把句柄缓存起来
SetLastError(0); // 设置无错误
......@@ -47,7 +62,12 @@ public static class UIHelper
}), pid);
return (!bResult && Marshal.GetLastWin32Error() == 0) ? ptrWnd : IntPtr.Zero;
if (!bResult && Marshal.GetLastWin32Error() == 0)
{
myHWND = ptrWnd;
}
return myHWND;
}
public static void Flash()
......@@ -55,6 +75,35 @@ public static class UIHelper
FlashWindow(GetProcessWnd(), true);
}
public static bool isMaximized()
{
#if UNITY_STANDALONE_WIN
return IsZoomed(GetProcessWnd());
#else
// not a easy thing to check window status on non-windows desktop...
return false;
#endif
}
public static void MaximizeWindow()
{
#if UNITY_STANDALONE_WIN
ShowWindow(GetProcessWnd(), 3); // SW_MAXIMIZE
#endif
}
public static void RestoreWindow()
{
#if UNITY_STANDALONE_WIN
ShowWindow(GetProcessWnd(), 9); // SW_RESTORE
#endif
}
public static bool shouldMaximize()
{
return fromStringToBool(Config.Get("maximize_", "0"));
}
public enum RenderingMode
{
Opaque,
......
......@@ -6649,7 +6649,7 @@ public class Ocgcore : ServantWithCardDescription
//op_m[m].isMinBlockMode = true;
if (Program.getVerticalTransparency() >= 0.5f)
{
gameField.isLong = true; //这个设定暂时取消
gameField.isLong = Program.longField; //这个设定恢复(?)
}
}
}
......
......@@ -1166,6 +1166,8 @@ public class Program : MonoBehaviour
{
preWid = Screen.width;
preheight = Screen.height;
//if (setting != null)
// setting.setScreenSizeValue();
Program.notGo(fixScreenProblems);
Program.go(500, fixScreenProblems);
}
......@@ -1177,8 +1179,24 @@ public class Program : MonoBehaviour
#endif
}
public static void PrintToChat(object o)
{
try
{
instance.cardDescription.mLog(o.ToString());
}
catch
{
DEBUGLOG(o);
}
}
void gameStart()
{
if (UIHelper.shouldMaximize())
{
UIHelper.MaximizeWindow();
}
backGroundPic.show();
shiftToServant(menu);
}
......@@ -1188,6 +1206,7 @@ public class Program : MonoBehaviour
public static bool MonsterCloud = false;
public static float fieldSize = 1;
public static bool longField = false;
void OnApplicationQuit()
{
......@@ -1223,6 +1242,10 @@ public class Program : MonoBehaviour
#endregion
public static void gugugu()
{
PrintToChat(InterString.Get("非常抱歉,因为技术原因,此功能暂时无法使用。请关注官方网站获取更多消息。"));
}
//递归创建目录
private static void DirPaths(string filefullpath)
{
......
......@@ -32,6 +32,12 @@ public class selectDeck : WindowServantSP
UIHelper.registEvent(gameObject, "copy_", onCopy);
UIHelper.registEvent(gameObject, "rename_", onRename);
UIHelper.registEvent(gameObject, "code_", onCode);
if (Application.systemLanguage == SystemLanguage.Chinese || Application.systemLanguage == SystemLanguage.ChineseSimplified || Application.systemLanguage == SystemLanguage.ChineseTraditional)
{
UIHelper.getByName<UILabel>(gameObject, "!default").text = "搜索卡组";
} else {
UIHelper.getByName<UILabel>(gameObject, "!default").text = "Search";
}
searchInput = UIHelper.getByName<UIInput>(gameObject, "search_");
superScrollView.install();
for (int i = 0; i < quickCards.Length; i++)
......
......@@ -15,15 +15,15 @@ public class Setting : WindowServant2D
UIHelper.registEvent(gameObject, "full_", resizeScreen);
UIHelper.registEvent(gameObject, "resize_", resizeScreen);
UIHelper.getByName<UIToggle>(gameObject, "full_").value = Screen.fullScreen;
UIHelper.getByName<UIPopupList>(gameObject, "screen_").value = Screen.width.ToString() + "*" + Screen.height.ToString();
UIHelper.getByName<UIToggle>(gameObject, "ignoreWatcher_").value = UIHelper.fromStringToBool(Config.Get("ignoreWatcher_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "ignoreOP_").value = UIHelper.fromStringToBool(Config.Get("ignoreOP_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "smartSelect_").value = UIHelper.fromStringToBool(Config.Get("smartSelect_", "1"));
UIHelper.getByName<UIToggle>(gameObject, "autoChain_").value = UIHelper.fromStringToBool(Config.Get("autoChain_", "1"));
UIHelper.getByName<UIToggle>(gameObject, "handPosition_").value = UIHelper.fromStringToBool(Config.Get("handPosition_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "handmPosition_").value = UIHelper.fromStringToBool(Config.Get("handmPosition_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "handPosition_").value = UIHelper.fromStringToBool(Config.Get("handPosition_", "1"));
UIHelper.getByName<UIToggle>(gameObject, "handmPosition_").value = UIHelper.fromStringToBool(Config.Get("handmPosition_", "1"));
UIHelper.getByName<UIToggle>(gameObject, "spyer_").value = UIHelper.fromStringToBool(Config.Get("spyer_", "1"));
UIHelper.getByName<UIToggle>(gameObject, "resize_").value = UIHelper.fromStringToBool(Config.Get("resize_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "longField_").value = UIHelper.fromStringToBool(Config.Get("longField_", "0"));
if (QualitySettings.GetQualityLevel() < 3)
{
UIHelper.getByName<UIToggle>(gameObject, "high_").value = false;
......@@ -40,11 +40,12 @@ public class Setting : WindowServant2D
UIHelper.registEvent(gameObject, "handmPosition_", save);
UIHelper.registEvent(gameObject, "spyer_", save);
UIHelper.registEvent(gameObject, "high_", save);
UIHelper.registEvent(gameObject, "longField_", onChangeLongField);
UIHelper.registEvent(gameObject, "size_", onChangeSize);
UIHelper.registEvent(gameObject, "alpha_", onChangeAlpha);
//UIHelper.registEvent(gameObject, "alpha_", onChangeAlpha);
UIHelper.registEvent(gameObject, "vSize_", onChangeVsize);
sliderSize = UIHelper.getByName<UISlider>(gameObject, "size_");
sliderAlpha = UIHelper.getByName<UISlider>(gameObject, "alpha_");
//sliderAlpha = UIHelper.getByName<UISlider>(gameObject, "alpha_");
sliderVsize = UIHelper.getByName<UISlider>(gameObject, "vSize_");
Program.go(2000, readVales);
var collection = gameObject.GetComponentsInChildren<UIToggle>();
......@@ -77,6 +78,7 @@ public class Setting : WindowServant2D
UIHelper.registEvent(setting.Vlink.gameObject, onCP);
onchangeMouse();
onchangeCloud();
setScreenSizeValue();
}
private void onchangeFPS()
......@@ -96,7 +98,7 @@ public class Setting : WindowServant2D
setting.sliderVolum.forceValue(((float)(int.Parse(Config.Get("vol_", "750")))) / 1000f);
setting.sliderSize.forceValue(((float)(int.Parse(Config.Get("size_", "500")))) / 1000f);
setting.sliderSizeDrawing.forceValue(((float)(int.Parse(Config.Get("vSize_", "500")))) / 1000f);
setting.sliderAlpha.forceValue(((float)(int.Parse(Config.Get("alpha_", "666")))) / 1000f);
//setting.sliderAlpha.forceValue(((float)(int.Parse(Config.Get("alpha_", "666")))) / 1000f);
onChangeAlpha();
onChangeSize();
}
......@@ -121,6 +123,14 @@ public class Setting : WindowServant2D
Program.I().mouseParticle.SetActive(setting.mouseEffect.value);
}
//private int dontResizeTwice = 2;
public void setScreenSizeValue()
{
//dontResizeTwice = 3;
UIHelper.getByName<UIPopupList>(gameObject, "screen_").value = Screen.width.ToString() + "*" + Screen.height.ToString();
}
void onCP()
{
try
......@@ -182,8 +192,14 @@ public class Setting : WindowServant2D
{
Program.transparency = 1.5f * sliderAlpha.value;
}
Program.transparency = 1f;
}
void onChangeLongField()
{
Program.longField = UIHelper.getByName<UIToggle>(gameObject, "longField_").value;
onCP();
}
UISlider sliderVsize;
void onChangeVsize()
......@@ -221,6 +237,14 @@ public class Setting : WindowServant2D
void resizeScreen()
{
//if (dontResizeTwice > 0)
//{
// dontResizeTwice--;
// return;
//}
//dontResizeTwice = 2;
if (UIHelper.isMaximized())
UIHelper.RestoreWindow();
string[] mats = UIHelper.getByName<UIPopupList>(gameObject, "screen_").value.Split(new string[] { "*" }, StringSplitOptions.RemoveEmptyEntries);
if (mats.Length == 2)
{
......@@ -234,7 +258,8 @@ public class Setting : WindowServant2D
Config.Set("vol_", ((int)(UIHelper.getByName<UISlider>(gameObject, "vol_").value * 1000)).ToString());
Config.Set("size_", ((int)(UIHelper.getByName<UISlider>(gameObject, "size_").value * 1000)).ToString());
Config.Set("vSize_", ((int)(UIHelper.getByName<UISlider>(gameObject, "vSize_").value * 1000)).ToString());
Config.Set("alpha_", ((int)(UIHelper.getByName<UISlider>(gameObject, "alpha_").value * 1000)).ToString());
//Config.Set("alpha_", ((int)(UIHelper.getByName<UISlider>(gameObject, "alpha_").value * 1000)).ToString());
Config.Set("longField_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "longField_").value));
var collection = gameObject.GetComponentsInChildren<UIToggle>();
for (int i = 0; i < collection.Length; i++)
{
......@@ -247,6 +272,7 @@ public class Setting : WindowServant2D
Config.Set("showoffStar", setting.showoffStar.value.ToString());
Config.Set("LimFPS", setting.LimFPS.value.ToString());
Config.Set("resize_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "resize_").value));
Config.Set("maximize_", UIHelper.fromBoolToString(UIHelper.isMaximized()));
}
public void save()
......
......@@ -25,7 +25,12 @@ public class SelectServer : WindowServantSP
UIHelper.registEvent(gameObject, "join_", onClickJoin);
serversList = UIHelper.getByName<UIPopupList>(gameObject, "server");
//serversList.fontSize = 30;
serversList.value = Config.Get("serversPicker", "[Custom]");
if (Application.systemLanguage == SystemLanguage.Chinese || Application.systemLanguage == SystemLanguage.ChineseSimplified || Application.systemLanguage == SystemLanguage.ChineseTraditional)
{
serversList.value = Config.Get("serversPicker", "[自定义]");
} else {
serversList.value = Config.Get("serversPicker", "[Custom]");
}
UIHelper.registEvent(gameObject, "server", pickServer);
UIHelper.getByName<UIInput>(gameObject, "name_").value = Config.Get("name", "YGOPro2 User");
list = UIHelper.getByName<UIPopupList>(gameObject, "history_");
......@@ -39,7 +44,7 @@ public class SelectServer : WindowServantSP
//inputVersion = UIHelper.getByName<UIInput>(gameObject, "version_");
set_version("0x" + String.Format("{0:X}", Config.ClientVersion));
if (Application.systemLanguage == SystemLanguage.ChineseSimplified || Application.systemLanguage == SystemLanguage.ChineseTraditional)
if (Application.systemLanguage == SystemLanguage.Chinese || Application.systemLanguage == SystemLanguage.ChineseSimplified || Application.systemLanguage == SystemLanguage.ChineseTraditional)
{}
else //如果非要改成其他语言的话
{
......@@ -54,7 +59,13 @@ public class SelectServer : WindowServantSP
serversList.items.Add("[TCG]Koishi");
serversList.items.Add("[轮抽服]2Pick");
serversList.items.Add("[OCG&TCG]한국서버");
serversList.items.Add("[Custom]");
serversList.items.Add("[OCG&TCG]YGOhollow (JP)");
if (Application.systemLanguage == SystemLanguage.Chinese || Application.systemLanguage == SystemLanguage.ChineseSimplified || Application.systemLanguage == SystemLanguage.ChineseTraditional)
{
serversList.items.Add("[自定义]");
} else {
serversList.items.Add("[Custom]");
}
SetActiveFalse();
}
......@@ -119,9 +130,25 @@ public class SelectServer : WindowServantSP
inputPort_.enabled = false;
break;
}
case "[OCG&TCG]YGOhollow (JP)":
{
UIHelper.getByName<UIInput>(gameObject, "ip_").value = "ygosvrjp.tk";
UIHelper.getByName<UIInput>(gameObject, "port_").value = "7911";
Config.Set("serversPicker", "[OCG&TCG]YGOhollow (JP)");
list.enabled = false;
inputIP_.enabled = false;
inputPort_.enabled = false;
break;
}
default:
{
Config.Set("serversPicker", "[Custom]");
if (Application.systemLanguage == SystemLanguage.Chinese || Application.systemLanguage == SystemLanguage.ChineseSimplified || Application.systemLanguage == SystemLanguage.ChineseTraditional)
{
Config.Set("serversPicker", "[自定义]");
} else {
Config.Set("serversPicker", "[Custom]");
}
list.enabled = true;
inputIP_.enabled = true;
......
This diff is collapsed.
......@@ -15,7 +15,7 @@ PlayerSettings:
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21176471, a: 1}
m_ShowUnitySplashScreen: 1
m_ShowUnitySplashScreen: 0
m_ShowUnitySplashLogo: 1
m_SplashScreenOverlayOpacity: 1
m_SplashScreenAnimation: 1
......@@ -76,7 +76,7 @@ PlayerSettings:
usePlayerLog: 1
bakeCollisionMeshes: 0
forceSingleInstance: 0
resizableWindow: 0
resizableWindow: 1
useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 0
......
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