Commit 065f88da authored by Unicorn369's avatar Unicorn369

Upgrade to Unity5.6.7f1

parent ff10f957
...@@ -6,22 +6,17 @@ ifndef config ...@@ -6,22 +6,17 @@ ifndef config
endif endif
export config export config
PROJECTS := sqlite3 ocgcore PROJECTS := ocgcore
.PHONY: all clean help $(PROJECTS) .PHONY: all clean help $(PROJECTS)
all: $(PROJECTS) all: $(PROJECTS)
sqlite3:
@echo "==== Building sqlite3 ($(config)) ===="
@${MAKE} --no-print-directory -C . -f sqlite3.make
ocgcore: ocgcore:
@echo "==== Building ocgcore ($(config)) ====" @echo "==== Building ocgcore ($(config)) ===="
@${MAKE} --no-print-directory -C . -f ocgcore.make @${MAKE} --no-print-directory -C . -f ocgcore.make
clean: clean:
@${MAKE} --no-print-directory -C . -f sqlite3.make clean
@${MAKE} --no-print-directory -C . -f ocgcore.make clean @${MAKE} --no-print-directory -C . -f ocgcore.make clean
help: help:
...@@ -34,7 +29,6 @@ help: ...@@ -34,7 +29,6 @@ help:
@echo "TARGETS:" @echo "TARGETS:"
@echo " all (default)" @echo " all (default)"
@echo " clean" @echo " clean"
@echo " sqlite3"
@echo " ocgcore" @echo " ocgcore"
@echo "" @echo ""
@echo "For more information, see http://industriousone.com/premake/quick-start" @echo "For more information, see http://industriousone.com/premake/quick-start"
# GNU Make project makefile autogenerated by Premake
ifndef config
config=release
endif
ifndef verbose
SILENT = @
endif
ifndef CC
CC = gcc
endif
ifndef CXX
CXX = g++
endif
ifndef AR
AR = ar
endif
ifeq ($(config),release)
OBJDIR = ../../obj/Linux/x86_64/sqlite3
TARGETDIR = ../../bin/x86_64
TARGET = $(TARGETDIR)/libsqlite3.so
DEFINES += -DLUA_USE_LINUX
INCLUDES +=
CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES)
CFLAGS += $(CPPFLAGS) $(ARCH) -Os -fPIC -fno-strict-aliasing -Wno-multichar
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s -shared
LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
endif
ifeq ($(config),release32)
OBJDIR = ../../obj/Linux/x86/sqlite3
TARGETDIR = ../../bin/x86
TARGET = $(TARGETDIR)/libsqlite3.so
DEFINES += -DLUA_USE_LINUX
INCLUDES +=
CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES)
CFLAGS += $(CPPFLAGS) $(ARCH) -Os -m32 -fPIC -fno-strict-aliasing -Wno-multichar
CXXFLAGS += $(CFLAGS)
LDFLAGS += -s -shared -m32 -L/usr/lib32
LIBS +=
RESFLAGS += $(DEFINES) $(INCLUDES)
LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
endif
OBJECTS := \
$(OBJDIR)/sqlite3.o \
RESOURCES := \
SHELLTYPE := msdos
ifeq (,$(ComSpec)$(COMSPEC))
SHELLTYPE := posix
endif
ifeq (/bin,$(findstring /bin,$(SHELL)))
SHELLTYPE := posix
endif
.PHONY: clean prebuild prelink
all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)
@:
$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)
@echo Linking sqlite3
$(SILENT) $(LINKCMD)
$(POSTBUILDCMDS)
$(TARGETDIR):
@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(TARGETDIR)
else
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif
$(OBJDIR):
@echo Creating $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(OBJDIR)
else
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
endif
clean:
@echo Cleaning sqlite3
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(OBJDIR)
else
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif
prebuild:
$(PREBUILDCMDS)
prelink:
$(PRELINKCMDS)
ifneq (,$(PCH))
$(GCH): $(PCH)
@echo $(notdir $<)
-$(SILENT) cp $< $(OBJDIR)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
endif
$(OBJDIR)/sqlite3.o: ../../ocgcore/sqlite3.c
@echo $(notdir $<)
$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"
-include $(OBJECTS:%.o=%.d)
...@@ -287,7 +287,7 @@ public class Program : MonoBehaviour ...@@ -287,7 +287,7 @@ public class Program : MonoBehaviour
Screen.sleepTimeout = SleepTimeout.NeverSleep; Screen.sleepTimeout = SleepTimeout.NeverSleep;
if (!File.Exists(ANDROID_GAME_PATH + "updates/version1.0.txt")) if (!File.Exists(ANDROID_GAME_PATH + "updates/version1.0.txt"))
{ {
string filePath = Application.streamingAssetsPath + "/ygocore.zip"; string filePath = Application.streamingAssetsPath + "/ygopro2.zip";
var www = new WWW(filePath); var www = new WWW(filePath);
while (!www.isDone) { } while (!www.isDone) { }
byte[] bytes = www.bytes; byte[] bytes = www.bytes;
...@@ -301,7 +301,7 @@ public class Program : MonoBehaviour ...@@ -301,7 +301,7 @@ public class Program : MonoBehaviour
string GamePaths = Application.persistentDataPath + "/ygopro2/"; 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"; string filePath = Application.streamingAssetsPath + "/ygopro2.zip";
var www = new WWW(filePath); var www = new WWW(filePath);
while (!www.isDone) { } while (!www.isDone) { }
byte[] bytes = www.bytes; byte[] bytes = www.bytes;
...@@ -995,6 +995,14 @@ public class Program : MonoBehaviour ...@@ -995,6 +995,14 @@ public class Program : MonoBehaviour
#region MonoBehaviors #region MonoBehaviors
private float LastUpdateShowTime = 0f;
private float UpdateShowDeltaTime = 1f; //更新帧率
private int FrameUpdate = 0;
private float m_FPS = 0;
void Start() void Start()
{ {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows #if UNITY_EDITOR || UNITY_STANDALONE_WIN //编译器、Windows
...@@ -1013,6 +1021,8 @@ public class Program : MonoBehaviour ...@@ -1013,6 +1021,8 @@ public class Program : MonoBehaviour
instance = this; instance = this;
initialize(); initialize();
go(500, () => { gameStart(); }); go(500, () => { gameStart(); });
LastUpdateShowTime = Time.realtimeSinceStartup;
} }
int preWid = 0; int preWid = 0;
...@@ -1023,15 +1033,26 @@ public class Program : MonoBehaviour ...@@ -1023,15 +1033,26 @@ public class Program : MonoBehaviour
void OnGUI() void OnGUI()
{ {
if (Event.current.type == EventType.ScrollWheel) if (Event.current.type == EventType.ScrollWheel) {
_padScroll = -Event.current.delta.y / 100; _padScroll = -Event.current.delta.y / 100;
else } else {
_padScroll = 0; _padScroll = 0;
}
//GUI.Label(new Rect(Screen.width / 2, 0, 100, 100), "FPS: " + m_FPS);
GUI.Label(new Rect(10, 5, 100, 100), "FPS: " + m_FPS);
} }
void Update() void Update()
{ {
FrameUpdate++;
if(Time.realtimeSinceStartup - LastUpdateShowTime >= UpdateShowDeltaTime)
{
m_FPS = FrameUpdate / (Time.realtimeSinceStartup - LastUpdateShowTime);
FrameUpdate = 0;
LastUpdateShowTime = Time.realtimeSinceStartup;
}
if (preWid != Screen.width || preheight != Screen.height) if (preWid != Screen.width || preheight != Screen.height)
{ {
Resources.UnloadUnusedAssets(); Resources.UnloadUnusedAssets();
......
...@@ -10,25 +10,34 @@ using UnityEngine; ...@@ -10,25 +10,34 @@ using UnityEngine;
public class HttpDldFile public class HttpDldFile
{ {
private readonly System.Threading.Semaphore semaphore = new System.Threading.Semaphore(6, 6);
public bool Download(string url, string filename) public bool Download(string url, string filename)
{ {
bool flag = false; bool flag = false;
try try
{ {
if(!Directory.Exists(Path.GetDirectoryName(filename))){ if (!Directory.Exists(Path.GetDirectoryName(filename)))
Directory.CreateDirectory(Path.GetDirectoryName(filename)); {
} Directory.CreateDirectory(Path.GetDirectoryName(filename));
}
using (var client = new WebClient())
{ using (var client = new TimeoutWebClient())
ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback; {
//client.Headers.Add(HttpRequestHeader.Authorization, string.Concat("token ", RepoData.GetToken())); ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;
client.Headers.Add(HttpRequestHeader.ContentType,"application/x-www-form-urlencoded; charset=UTF-8");
client.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063"); if (Path.GetExtension(filename).Contains("png"))
client.DownloadFile(new Uri(url), filename+".tmp"); {
} client.Timeout = 6500;
flag = true; }
if(File.Exists(filename)) if (Path.GetExtension(filename).Contains("jpg"))
{
client.Timeout = 3500;
}
semaphore.WaitOne();
client.DownloadFile(new Uri(url), filename + ".tmp");
}
flag = true;
if (File.Exists(filename))
{ {
File.Delete(filename); File.Delete(filename);
} }
...@@ -38,6 +47,10 @@ public class HttpDldFile ...@@ -38,6 +47,10 @@ public class HttpDldFile
{ {
flag = false; flag = false;
} }
finally
{
semaphore.Release();
}
return flag; return flag;
} }
public static bool MyRemoteCertificateValidationCallback(System.Object sender, public static bool MyRemoteCertificateValidationCallback(System.Object sender,
...@@ -68,5 +81,25 @@ public class HttpDldFile ...@@ -68,5 +81,25 @@ public class HttpDldFile
} }
return isOk; return isOk;
} }
}
public class TimeoutWebClient : WebClient
{
public int Timeout { get; set; }
public TimeoutWebClient()
{
Timeout = 10000;
}
public TimeoutWebClient(int timeout)
{
Timeout = timeout;
}
protected override WebRequest GetWebRequest(Uri address)
{
WebRequest request = base.GetWebRequest(address);
request.Timeout = Timeout;
return request;
}
} }
\ No newline at end of file
using UnityEngine; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Linq; using System.Linq;
public class RoomList : WindowServantSP public class RoomList : WindowServantSP
...@@ -11,13 +8,13 @@ public class RoomList : WindowServantSP ...@@ -11,13 +8,13 @@ public class RoomList : WindowServantSP
List<string[]> listOfRooms = new List<string[]>(); List<string[]> listOfRooms = new List<string[]>();
bool hideAI; bool hideAI;
bool hideStarted; bool hideStarted;
UILabel roomNameLabel; UILabel roomPSWLabel;
public override void initialize() public override void initialize()
{ {
createWindow(Program.I().new_ui_RoomList); createWindow(Program.I().new_ui_RoomList);
UIHelper.registEvent(gameObject, "exit_", onClickExit); UIHelper.registEvent(gameObject, "exit_", onClickExit);
UIHelper.registEvent(gameObject, "refresh_", onRefresh); UIHelper.registEvent(gameObject, "refresh_", onRefresh);
roomNameLabel = UIHelper.getByName<UILabel>(gameObject, "roomNameLabel"); roomPSWLabel = UIHelper.getByName<UILabel>(gameObject, "roomNameLabel");
hideAI =UIHelper.getByName<UIToggle>(gameObject, "hideAIrooms_").value = UIHelper.fromStringToBool(Config.Get("hideAIrooms_", "1")); 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")); hideStarted=UIHelper.getByName<UIToggle>(gameObject, "hideStarted_").value = UIHelper.fromStringToBool(Config.Get("hideStarted_", "1"));
UIHelper.registEvent(gameObject, "hideAIrooms_", save); UIHelper.registEvent(gameObject, "hideAIrooms_", save);
...@@ -54,7 +51,7 @@ public class RoomList : WindowServantSP ...@@ -54,7 +51,7 @@ public class RoomList : WindowServantSP
} }
public override void hide() public override void hide()
{ {
roomNameLabel.text = ""; roomPSWLabel.text = "";
base.hide(); base.hide();
} }
...@@ -77,17 +74,6 @@ public class RoomList : WindowServantSP ...@@ -77,17 +74,6 @@ public class RoomList : WindowServantSP
{ {
superScrollView.add(room[9]); 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; string selectedString = string.Empty;
...@@ -106,12 +92,14 @@ public class RoomList : WindowServantSP ...@@ -106,12 +92,14 @@ public class RoomList : WindowServantSP
} }
selectedString = superScrollView.selectedString; selectedString = superScrollView.selectedString;
roomPsw= listOfRooms.Find(s => s[9] == selectedString)[2]; roomPsw= listOfRooms.Find(s => s[9] == selectedString)[2];
int roomNameIndex = roomPsw.LastIndexOf("#")+1; if (roomPsw != null)
if (roomNameIndex > 0)
{ {
roomNameLabel.text = roomPsw.Substring(roomNameIndex); roomPSWLabel.text = roomPsw;
} }
else
{
roomPSWLabel.text = "";
}
} }
void JoinRoom(string selectedString,string roomPsw) void JoinRoom(string selectedString,string roomPsw)
......
...@@ -6,6 +6,8 @@ public class Setting : WindowServant2D ...@@ -6,6 +6,8 @@ public class Setting : WindowServant2D
public LAZYsetting setting; public LAZYsetting setting;
public bool batterySaving;
public override void initialize() public override void initialize()
{ {
gameObject = createWindow(this, Program.I().new_ui_setting); gameObject = createWindow(this, Program.I().new_ui_setting);
...@@ -14,6 +16,8 @@ public class Setting : WindowServant2D ...@@ -14,6 +16,8 @@ public class Setting : WindowServant2D
UIHelper.registEvent(gameObject, "screen_", resizeScreen); UIHelper.registEvent(gameObject, "screen_", resizeScreen);
UIHelper.registEvent(gameObject, "full_", resizeScreen); UIHelper.registEvent(gameObject, "full_", resizeScreen);
UIHelper.registEvent(gameObject, "resize_", resizeScreen); UIHelper.registEvent(gameObject, "resize_", resizeScreen);
UIHelper.registEvent(gameObject, "batterySaving", batterySavingMode);
batterySaving = UIHelper.getByName<UIToggle>(gameObject, "batterySaving").value = UIHelper.fromStringToBool(Config.Get("batterySaving", "0"));
UIHelper.getByName<UIToggle>(gameObject, "full_").value = Screen.fullScreen; UIHelper.getByName<UIToggle>(gameObject, "full_").value = Screen.fullScreen;
UIHelper.getByName<UIPopupList>(gameObject, "screen_").value = Screen.width.ToString() + "*" + Screen.height.ToString(); 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, "ignoreWatcher_").value = UIHelper.fromStringToBool(Config.Get("ignoreWatcher_", "0"));
...@@ -77,6 +81,20 @@ public class Setting : WindowServant2D ...@@ -77,6 +81,20 @@ public class Setting : WindowServant2D
onchangeCloud(); onchangeCloud();
} }
private void batterySavingMode()
{
if (batterySaving)
{
Application.targetFrameRate = 30;
}
else
{
Application.targetFrameRate = -1;
}
batterySaving = !batterySaving;
save();
}
private void readVales() private void readVales()
{ {
try try
...@@ -237,6 +255,7 @@ public class Setting : WindowServant2D ...@@ -237,6 +255,7 @@ public class Setting : WindowServant2D
public void save() public void save()
{ {
Config.Set("batterySaving", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "batterySaving").value));
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("ignoreOP_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "ignoreOP_").value));
Config.Set("smartSelect_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "smartSelect_").value)); Config.Set("smartSelect_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "smartSelect_").value));
......
fileFormatVersion: 2
guid: 7cc6adf5988b03345bc3fbbdb145cbab
timeCreated: 1548561685
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
m_EditorVersion: 5.6.6f2 m_EditorVersion: 5.6.7f1
...@@ -54,9 +54,9 @@ The feedbacks is checked every day. ...@@ -54,9 +54,9 @@ The feedbacks is checked every day.
> `cp -f -r libs ../../../Assets/Plugins/Android/` > `cp -f -r libs ../../../Assets/Plugins/Android/`
# How to compile the libocgcore.so、libsqlite3.so? (Linux) # How to compile the libocgcore.so? (Linux)
*In most case you do not need to care about the libocgcore.so、libsqlite3.so.* *In most case you do not need to care about the libocgcore.so.*
> `cd AI_core_vs2017solution/build/gmake.linux` > `cd AI_core_vs2017solution/build/gmake.linux`
......
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