Commit 3606ed65 authored by hex's avatar hex

Remove saved window position offsets, always center popup windows

parent d7adc838
Pipeline #38385 failed
using UnityEngine;
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using System.Collections.Generic;
using UnityEngine;
public class Menu : WindowServantSP
public class Menu : WindowServantSP
{
//GameObject screen;
public override void initialize()
......@@ -40,6 +40,7 @@ public class Menu : WindowServantSP
static int Version = 0;
string upurl = "";
void up()
{
try
......@@ -80,6 +81,7 @@ public class Menu : WindowServantSP
}
bool outed = false;
public override void preFrameFunction()
{
base.preFrameFunction();
......@@ -154,15 +156,29 @@ public class Menu : WindowServantSP
Application.OpenURL("https://github.com/Unicorn369/closeup_mobile/releases/tag/0.1");
#elif UNITY_ANDROID //Android
AndroidJavaObject jo = new AndroidJavaObject("cn.unicorn369.library.API");
if (!File.Exists("updates/closeup_0.1.txt")) {//用于检查更新
if (File.Exists("closeup_0.1.zip")) {//如果有则直接解压
if (!File.Exists("updates/closeup_0.1.txt"))
{ //用于检查更新
if (File.Exists("closeup_0.1.zip"))
{ //如果有则直接解压
jo.Call("doExtractZipFile", "closeup_0.1.zip", Program.ANDROID_GAME_PATH);
} else if (File.Exists("updates/closeup_0.1.txt")){//如果有则下载更新包
jo.Call("doDownloadZipFile", "https://github.com/Unicorn369/closeup_mobile/releases/download/0.1/closeup_0.1.zip");
} else {//否则下载并解压,锁定目录:ANDROID_GAME_PATH
jo.Call("doDownloadZipFile", "https://github.com/Unicorn369/closeup_mobile/releases/download/0.1/closeup_0.1.zip");
}
} else {
else if (File.Exists("updates/closeup_0.1.txt"))
{ //如果有则下载更新包
jo.Call(
"doDownloadZipFile",
"https://github.com/Unicorn369/closeup_mobile/releases/download/0.1/closeup_0.1.zip"
);
}
else
{ //否则下载并解压,锁定目录:ANDROID_GAME_PATH
jo.Call(
"doDownloadZipFile",
"https://github.com/Unicorn369/closeup_mobile/releases/download/0.1/closeup_0.1.zip"
);
}
}
else
{
jo.Call("showToast", "已是最新,无需再次下载!");
Program.PrintToChat(InterString.Get("已是最新,无需再次下载!"));
}
......@@ -178,12 +194,11 @@ public class Menu : WindowServantSP
File.Delete("commamd.shell");
}
}
catch (Exception)
{
}
catch (Exception) { }
}
static int lastTime = 0;
public static void checkCommend()
{
if (Program.TimePassed() - lastTime > 1000)
......@@ -223,7 +238,7 @@ public class Menu : WindowServantSP
string all = "";
try
{
all = File.ReadAllText("commamd.shell",Encoding.UTF8);
all = File.ReadAllText("commamd.shell", Encoding.UTF8);
string[] mats = all.Split(" ");
if (mats.Length > 0)
{
......@@ -232,33 +247,43 @@ public class Menu : WindowServantSP
case "online":
if (mats.Length == 5)
{
UIHelper.iniFaces();//加载用户头像
Program.I().selectServer.KF_onlineGame(mats[1], mats[2], mats[3], mats[4]);
UIHelper.iniFaces(); //加载用户头像
Program
.I()
.selectServer.KF_onlineGame(mats[1], mats[2], mats[3], mats[4]);
}
if (mats.Length == 6)
{
UIHelper.iniFaces();
Program.I().selectServer.KF_onlineGame(mats[1], mats[2], mats[3], mats[4], mats[5]);
Program
.I()
.selectServer.KF_onlineGame(
mats[1],
mats[2],
mats[3],
mats[4],
mats[5]
);
}
break;
case "edit":
if (mats.Length == 2)
{
Program.I().selectDeck.KF_editDeck(mats[1]);//编辑卡组
Program.I().selectDeck.KF_editDeck(mats[1]); //编辑卡组
}
break;
case "replay":
if (mats.Length == 2)
{
UIHelper.iniFaces();
Program.I().selectReplay.KF_replay(mats[1]);//编辑录像
Program.I().selectReplay.KF_replay(mats[1]); //编辑录像
}
break;
case "puzzle":
if (mats.Length == 2)
{
UIHelper.iniFaces();
Program.I().puzzleMode.KF_puzzle(mats[1]);//运行残局
Program.I().puzzleMode.KF_puzzle(mats[1]); //运行残局
}
break;
default:
......
using System;
using UnityEngine;
public class WindowServantSP : Servant
public class WindowServantSP : Servant
{
public bool instanceHide = false;
......@@ -31,7 +32,7 @@ public class WindowServantSP : Servant
base.applyHideArrangement();
if (gameObject != null)
{
if (instanceHide)
if (instanceHide)
{
return;
}
......@@ -51,7 +52,7 @@ public class WindowServantSP : Servant
resize();
}
public void SetActiveFalse()
public void SetActiveFalse()
{
gameObject.SetActive(false);
}
......@@ -101,19 +102,17 @@ public class WindowServantSP : Servant
public void createWindow(GameObject mod)
{
gameObject = create
(
mod,
Vector3.zero,
Vector3.zero,
false,
Program.ui_windows_2d
);
gameObject = create(mod, Vector3.zero, Vector3.zero, false, Program.ui_windows_2d);
UIHelper.InterGameObject(gameObject);
Vector3 v=new Vector3();
v.x = Mathf.Clamp(Config.getFloat("x_" + gameObject.name), -0.5f, 0.5f) * (float)Screen.width;
v.y = Mathf.Clamp(Config.getFloat("y_" + gameObject.name), -0.5f, 0.5f) * (float)Screen.height;
gameObject.transform.localPosition = v;
// Vector3 v = new Vector3();
// v.x =
// Mathf.Clamp(Config.getFloat("x_" + gameObject.name), -0.5f, 0.5f) * (float)Screen.width;
// v.y =
// Mathf.Clamp(Config.getFloat("y_" + gameObject.name), -0.5f, 0.5f)
// * (float)Screen.height;
// gameObject.transform.localPosition = v;
// 原本是从配置读取坐标——删除或注释掉, 只进行居中显示
gameObject.transform.localPosition = Vector3.zero;
var panelKIller = gameObject.GetComponent<panelKIller>();
if (panelKIller == null)
{
......@@ -125,10 +124,13 @@ public class WindowServantSP : Servant
public override void ES_quit()
{
base.ES_quit();
// 不再保存坐标
/*
if (gameObject != null)
{
Config.setFloat("x_" + gameObject.name, gameObject.transform.localPosition.x / (float)Screen.width);
Config.setFloat("y_" + gameObject.name, gameObject.transform.localPosition.y / (float)Screen.height);
}
*/
}
}
......@@ -1221,7 +1221,7 @@ MonoBehaviour:
generateNormals: 0
widgetsAreStatic: 0
cullWhileDragging: 1
alwaysOnScreen: 0
alwaysOnScreen: 1
anchorOffset: 0
softBorderPadding: 1
renderQueue: 0
......
......@@ -184,7 +184,7 @@ PlayerSettings:
serializedVersion: 2
m_Bits: 238
iPhoneSdkVersion: 988
iOSTargetOSVersionString: 15.0
iOSTargetOSVersionString: 13.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString: 9.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