From 11971eedb6531fa41b33111e917d877e5aed7e1a Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期四, 21 二月 2019 11:18:22 +0800
Subject: [PATCH] Merge branch 'master' into TreasureRevise

---
 Core/Camera/CameraController.cs                        |    2 
 Core/GameEngine/SnxxzGame.cs                           |    6 +
 Lua/Gen/LaunchPostProcessWrap.cs                       |   17 ---
 System/CrossServerOneVsOne/CrossServerOneVsOneModel.cs |   17 ++-
 System/Login/LoginModel.cs                             |   33 +++++-
 Core/GameEngine/Login/Launch.cs                        |    8 +
 System/Dungeon/DungeonModel.cs                         |    9 +
 Core/GameEngine/Login/LaunchPostProcess.cs             |   10 -
 Core/SDK/SDKUtility.cs                                 |   88 +++++++++++++---
 System/NewBieGuidance/NewBieCenter.cs                  |    6 
 System/Team/TeamModel.cs                               |    6 +
 System/FindPrecious/DemonJarBossLifeBarWin.cs          |   34 ++++--
 System/Dungeon/TargetBriefInfoWin.cs                   |    4 
 System/FakeDungeon/FakeDemonJarDungeonStage.cs         |    2 
 14 files changed, 168 insertions(+), 74 deletions(-)

diff --git a/Core/Camera/CameraController.cs b/Core/Camera/CameraController.cs
index 1c151e3..0e4852a 100644
--- a/Core/Camera/CameraController.cs
+++ b/Core/Camera/CameraController.cs
@@ -110,6 +110,8 @@
 
     public void ResetOriginal()
     {
+        SnxxzGame.Instance.StopAllCameraCo();
+        StopAllCoroutines();
         RotationDamping = 0.02f;
         ZoomDamping = 0.02f;
         sceneDistance = Distance = originalDistance;
diff --git a/Core/GameEngine/Login/Launch.cs b/Core/GameEngine/Login/Launch.cs
index a6a7313..5979d03 100644
--- a/Core/GameEngine/Login/Launch.cs
+++ b/Core/GameEngine/Login/Launch.cs
@@ -284,7 +284,13 @@
             }
         }
 #endif
-
+#if UNITY_EDITOR
+            if (!AssetSource.allFromEditor)
+            {
+                FileExtersion.DirectoryCopy(ResourcesPath.CONFIG_FODLER, ResourcesPath.Instance.StreamingAssetPath + "config");
+                FileExtersion.DirectoryCopy(ResourcesPath.ResourcesOutPath + "BuiltIn", ResourcesPath.Instance.StreamingAssetPath + "builtin");
+            }
+#endif
             if (!firstLaunch)
             {
                 done = true;
diff --git a/Core/GameEngine/Login/LaunchPostProcess.cs b/Core/GameEngine/Login/LaunchPostProcess.cs
index 9824bb2..aa0879e 100644
--- a/Core/GameEngine/Login/LaunchPostProcess.cs
+++ b/Core/GameEngine/Login/LaunchPostProcess.cs
@@ -2,7 +2,6 @@
 using System.Collections.Generic;
 using UnityEngine;
 using Snxxz.UI;
-
 using System;
 
 [XLua.LuaCallCSharp]
@@ -11,14 +10,13 @@
 
     bool m_Completed = false;
     public bool completed { get { return m_Completed; } set { m_Completed = value; } }
-    public float progress { get { return Mathf.Clamp01((Time.time - startTime) * 0.1f + ConfigInitiator.progress * 0.7f); } }
 
-    float startTime = 0f;
+    DateTime startTime;
 
     public void Begin()
     {
         completed = false;
-        startTime = Time.time;
+        startTime = DateTime.Now;
         ConfigInitiator.Init();
     }
 
@@ -26,6 +24,8 @@
     {
         if (!completed && ConfigInitiator.done)
         {
+            DebugEx.LogFormat("瑙f瀽閰嶇疆琛ㄨ�楁椂锛歿0}", (DateTime.Now - startTime).TotalMilliseconds);
+
             try
             {
                 InGameDownLoad.Instance.ParseRewardConfig();
@@ -43,8 +43,6 @@
                 {
                     AssetDeCompressTask.Delete7zFiles(ResourcesPath.Instance.ExternalStorePath);
                 }
-
-                DebugEx.LogFormat("瑙f瀽閰嶇疆琛ㄨ�楁椂锛歿0}", Time.time - startTime);
             }
             catch (Exception ex)
             {
diff --git a/Core/GameEngine/SnxxzGame.cs b/Core/GameEngine/SnxxzGame.cs
index f0cfae6..885cf69 100644
--- a/Core/GameEngine/SnxxzGame.cs
+++ b/Core/GameEngine/SnxxzGame.cs
@@ -220,6 +220,12 @@
         }
     }
 
+    public void StopAllCameraCo()
+    {
+        StopCoroutine("Co_ResetCamera");
+        StopCoroutine("Co_MovingCamera");
+    }
+
     private IEnumerator Co_MovingCamera(int _type)
     {
         var _areaCamera = AreaCameraConfig.Get(_type);
diff --git a/Core/SDK/SDKUtility.cs b/Core/SDK/SDKUtility.cs
index 134a9b6..3557210 100644
--- a/Core/SDK/SDKUtility.cs
+++ b/Core/SDK/SDKUtility.cs
@@ -27,11 +27,18 @@
         Js = 4,// 鏋侀��
         Yj = 5,// 鏄撴帴
         Yl = 6,// 鏄撲箰
+        Xn = 7,// 灏忕墰
+        Cjm = 8,// 瓒呯骇姊�
     }
 
     public E_ChannelPlatform ChannelPlatform { get; set; }
 
     public static string Yj_AppID
+    {
+        get; private set;
+    }
+
+    public static string Yj_Version
     {
         get; private set;
     }
@@ -118,6 +125,7 @@
     {
         Yj_AppID = string.Empty;
         Yj_SpID = string.Empty;
+        Yj_Version = string.Empty;
         RegistrationID = string.Empty;
         AssetCopyFinished = false;
         ChannelPlatform = E_ChannelPlatform.Free;
@@ -350,6 +358,20 @@
                 {
                     _result = "yileplatform";
                 }
+                else if (ChannelPlatform == E_ChannelPlatform.Xn)
+                {
+                    using (AndroidJavaClass _jc = new AndroidJavaClass("com.secondworld.univeralsdk.UniversalUtil"))
+                    {
+                        _result = _jc.CallStatic<string>("getMetaString", "XnAppID");
+                    }
+                }
+                else if (ChannelPlatform == E_ChannelPlatform.Cjm)
+                {
+                    using (AndroidJavaClass _jc = new AndroidJavaClass("com.secondworld.univeralsdk.UniversalUtil"))
+                    {
+                        _result = _jc.CallStatic<string>("getMetaString", "SUPERDREAM_APPID");
+                    }
+                }
                 break;
             case RuntimePlatform.IPhonePlayer:
                 _result = "ios";//ios骞冲彴鍥哄畾杩斿洖ios
@@ -453,6 +475,14 @@
                         {
                             ChannelPlatform = E_ChannelPlatform.Yl;
                         }
+                        else if (_channelPlatform.Equals("xn"))
+                        {
+                            ChannelPlatform = E_ChannelPlatform.Xn;
+                        }
+                        else if (_channelPlatform.Equals("cjm"))
+                        {
+                            ChannelPlatform = E_ChannelPlatform.Cjm;
+                        }
                     }
                 }
 
@@ -468,6 +498,27 @@
                         Yj_SpID = _json["yj_spid"].ToString();
                     }
                 }
+                else if (ChannelPlatform == E_ChannelPlatform.Xn)
+                {
+                    if (_dict.Contains("xnappid"))
+                    {
+                        Yj_AppID = _json["xnappid"].ToString();
+                    }
+
+                    if (_dict.Contains("xnversion"))
+                    {
+                        Yj_Version = _json["xnversion"].ToString();
+                    }
+                }
+                else if (ChannelPlatform == E_ChannelPlatform.Cjm)
+                {
+                    if (_dict.Contains("cjmappid"))
+                    {
+                        Yj_AppID = _json["cjmappid"].ToString();
+                    }
+                }
+
+
 
                 if (_dict.Contains("banhao"))
                 {
@@ -866,6 +917,14 @@
         {
             m_PaymentTable["RechargeChannel"] = "6";
         }
+        else if (ChannelPlatform == E_ChannelPlatform.Xn)
+        {
+            m_PaymentTable["RechargeChannel"] = "7";
+        }
+        else if (ChannelPlatform == E_ChannelPlatform.Cjm)
+        {
+            m_PaymentTable["RechargeChannel"] = "8";
+        }
 
         var _stringBuilder = new System.Text.StringBuilder();
         var _md5Body = _stringBuilder.Append(m_PaymentTable["AppID"]).
@@ -907,29 +966,20 @@
                         m_Json["mount"] = money;
                         m_Json["cpInfo"] = cpInfo;
                         m_Json["title"] = title;
-
-                        if(ChannelPlatform == E_ChannelPlatform.Mr
-                        || ChannelPlatform == E_ChannelPlatform.Sp
-                        || ChannelPlatform == E_ChannelPlatform.Yl)
-                        {
-                            m_Json["roleID"] = PlayerDatas.Instance.baseData.PlayerID;
-                            m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
-                            m_Json["level"] = PlayerDatas.Instance.baseData.LV.ToString();
-                            m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
-                        }
+                        m_Json["roleID"] = PlayerDatas.Instance.baseData.PlayerID;
+                        m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName;
+                        m_Json["level"] = PlayerDatas.Instance.baseData.LV.ToString();
+                        m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag;
+                        m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
+                        m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
+                        m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
+                        m_Json["money"] = PlayerDatas.Instance.baseData.Gold.ToString();
+                        m_Json["gameName"] = VersionConfig.Get().productName;
+                        m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
 
                         if (ChannelPlatform == E_ChannelPlatform.Mr)
                         {
                             m_Json["notifyurl"] = _json["notifyurl"];
-                        }
-                        else if(ChannelPlatform == E_ChannelPlatform.Sp)
-                        {
-                            m_Json["serverName"] = ServerListCenter.Instance.currentServer.name;
-                            m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName;
-                            m_Json["job"] = PlayerDatas.Instance.baseData.Job.ToString();
-                            m_Json["money"] = PlayerDatas.Instance.baseData.Gold.ToString();
-                            m_Json["gameName"] = VersionConfig.Get().productName;
-                            m_Json["vipLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
                         }
 #if UNITY_IOS
                         m_Json["identifier"] = VersionConfig.Get().bundleIdentifier;
diff --git a/Lua/Gen/LaunchPostProcessWrap.cs b/Lua/Gen/LaunchPostProcessWrap.cs
index eb34d1a..80d4208 100644
--- a/Lua/Gen/LaunchPostProcessWrap.cs
+++ b/Lua/Gen/LaunchPostProcessWrap.cs
@@ -21,13 +21,12 @@
         {
 			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
 			System.Type type = typeof(LaunchPostProcess);
-			Utils.BeginObjectRegister(type, L, translator, 0, 1, 2, 1);
+			Utils.BeginObjectRegister(type, L, translator, 0, 1, 1, 1);
 			
 			Utils.RegisterFunc(L, Utils.METHOD_IDX, "Begin", _m_Begin);
 			
 			
 			Utils.RegisterFunc(L, Utils.GETTER_IDX, "completed", _g_get_completed);
-            Utils.RegisterFunc(L, Utils.GETTER_IDX, "progress", _g_get_progress);
             
 			Utils.RegisterFunc(L, Utils.SETTER_IDX, "completed", _s_set_completed);
             
@@ -113,20 +112,6 @@
 			
                 LaunchPostProcess gen_to_be_invoked = (LaunchPostProcess)translator.FastGetCSObj(L, 1);
                 LuaAPI.lua_pushboolean(L, gen_to_be_invoked.completed);
-            } catch(System.Exception gen_e) {
-                return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
-            }
-            return 1;
-        }
-        
-        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
-        static int _g_get_progress(RealStatePtr L)
-        {
-		    try {
-                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
-			
-                LaunchPostProcess gen_to_be_invoked = (LaunchPostProcess)translator.FastGetCSObj(L, 1);
-                LuaAPI.lua_pushnumber(L, gen_to_be_invoked.progress);
             } catch(System.Exception gen_e) {
                 return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
             }
diff --git a/System/CrossServerOneVsOne/CrossServerOneVsOneModel.cs b/System/CrossServerOneVsOne/CrossServerOneVsOneModel.cs
index 3d307e8..9cc2596 100644
--- a/System/CrossServerOneVsOne/CrossServerOneVsOneModel.cs
+++ b/System/CrossServerOneVsOne/CrossServerOneVsOneModel.cs
@@ -73,6 +73,10 @@
         public void OnSwitchAccount()
         {
             IsMatching = false;
+            if (clientMatchClock!=null )
+            {
+                clientMatchClock.Stop();
+            }
         }
 
         public void OnPlayerLoginOk()
@@ -467,12 +471,13 @@
                     GameNetSystem.Instance.PushPackage(onMatchPackage, ServerType.Main);
                     var randomWaitSeconds = UnityEngine.Random.Range(3, 8);
                     clientMatchClock = Clock.Create(DateTime.Now + new TimeSpan(randomWaitSeconds * TimeSpan.TicksPerSecond), () =>
-                   {
-                       if (StageLoad.Instance.stageType == Stage.E_StageType.Dungeon)
-                       {
-                           ClientCrossServerOneVsOne.FakeMatchOk();
-                       }
-                   });
+                    {
+                        IsMatching = false;
+                        if (GameNetSystem.Instance.netState == GameNetSystem.NetState.Connected)
+                        {
+                            ClientCrossServerOneVsOne.FakeMatchOk();
+                        }
+                    });
                 }
                 else
                 {
diff --git a/System/Dungeon/DungeonModel.cs b/System/Dungeon/DungeonModel.cs
index 5e0bb93..5883bb8 100644
--- a/System/Dungeon/DungeonModel.cs
+++ b/System/Dungeon/DungeonModel.cs
@@ -1207,9 +1207,9 @@
 
         public void RequestChallangeDungeon(int _dataMapId, int _lineId)
         {
+            var dungeonConfig = DungeonConfig.Get(GetDungeonId(_dataMapId, _lineId));
             if (!AssetSource.sceneFromEditor)
             {
-                var dungeonConfig = DungeonConfig.Get(GetDungeonId(_dataMapId, _lineId));
                 var assetValid = true;
                 if (dungeonConfig != null)
                 {
@@ -1223,6 +1223,13 @@
                 }
             }
 
+            var model = ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>();
+            if (model.IsMatching)
+            {
+                SysNotifyMgr.Instance.ShowTip("CrossMatching8", dungeonConfig.MapID);
+                return;
+            }
+
             if (CrossServerLogin.Instance.IsEnterCrossServerPreparing())
             {
                 return;
diff --git a/System/Dungeon/TargetBriefInfoWin.cs b/System/Dungeon/TargetBriefInfoWin.cs
index efd5c50..90d7cc4 100644
--- a/System/Dungeon/TargetBriefInfoWin.cs
+++ b/System/Dungeon/TargetBriefInfoWin.cs
@@ -96,8 +96,8 @@
             {
                 instanceId = _instanceId,
                 npcId = _npcId,
-                hp = boss.ActorInfo.RealHp,
-                maxHp = boss.ActorInfo.RealMaxHp,
+                hp = _hp,
+                maxHp = _maxHp,
                 level = boss.ActorInfo.LV
             };
         }
diff --git a/System/FakeDungeon/FakeDemonJarDungeonStage.cs b/System/FakeDungeon/FakeDemonJarDungeonStage.cs
index 38709c1..f5793ad 100644
--- a/System/FakeDungeon/FakeDemonJarDungeonStage.cs
+++ b/System/FakeDungeon/FakeDemonJarDungeonStage.cs
@@ -349,7 +349,7 @@
 
         if (_victimId == boss.ServerInstID)
         {
-            TargetBriefInfo.OnRefreshBossLifeBar(_victimId, 0, 0, 0);
+            TargetBriefInfo.OnRefreshBossLifeBar(_victimId, boss.NpcConfig.NPCID, (ulong)Random.Range(0, 1000), 1000);
         }
     }
 
diff --git a/System/FindPrecious/DemonJarBossLifeBarWin.cs b/System/FindPrecious/DemonJarBossLifeBarWin.cs
index f794466..5ef84c9 100644
--- a/System/FindPrecious/DemonJarBossLifeBarWin.cs
+++ b/System/FindPrecious/DemonJarBossLifeBarWin.cs
@@ -26,14 +26,11 @@
         bool inited = false;
 
         long m_CurrentHp = BOSSHP_TOTAL;
-        long currentHp
-        {
-            get
-            {
+        long currentHp {
+            get {
                 return m_CurrentHp;
             }
-            set
-            {
+            set {
                 if (value <= 0)
                 {
                     m_CurrentHp = 0;
@@ -97,7 +94,14 @@
                 bossInfo = TargetBriefInfo.bossInfo;
                 if (bossInfo.instanceId != 0)
                 {
-                    RefreshBossLifeBar();
+                    if (inited)
+                    {
+                        RefreshBossLifeBar();
+                    }
+                    else
+                    {
+                        InitBossLifeBar();
+                    }
                 }
             }
         }
@@ -119,14 +123,16 @@
             }
         }
 
-        public void InitBossLifeBar()
+        void InitBossLifeBar()
         {
-            m_BossLifeBar.gameObject.SetActive(true);
-            var npcConfig = NPCConfig.Get(TargetBriefInfo.bossInfo.npcId);
-            currentHp = (long)(model.mission.remainHPPer * 0.000001d * BOSSHP_TOTAL);
-
-            m_BossLifeBar.SetBaseInfo(TargetBriefInfo.bossInfo.npcId, (ulong)currentHp, BOSSHP_TOTAL, npcConfig.NPCLV);
-            inited = true;
+            var config = NPCConfig.Get(TargetBriefInfo.bossInfo.npcId);
+            if (config!=null)
+            {
+                m_BossLifeBar.gameObject.SetActive(true);
+                currentHp = (long)(model.mission.remainHPPer * 0.000001d * BOSSHP_TOTAL);
+                m_BossLifeBar.SetBaseInfo(TargetBriefInfo.bossInfo.npcId, (ulong)currentHp, BOSSHP_TOTAL, config.NPCLV);
+                inited = true;
+            }
         }
 
         private void UpdateServerRemainHP()
diff --git a/System/Login/LoginModel.cs b/System/Login/LoginModel.cs
index 9f1bff2..5312a63 100644
--- a/System/Login/LoginModel.cs
+++ b/System/Login/LoginModel.cs
@@ -16,7 +16,8 @@
         public SDKUtility.FP_LoginOk sdkLoginResult;
         public SDKUtility.FP_CheckIDAuthentication sdkIDCheckIDAuthentication;
 
-        public string localSaveAccountName {
+        public string localSaveAccountName
+        {
             get { return LocalSave.GetString(USER_ACCOUNT); }
             set { LocalSave.SetString(USER_ACCOUNT, value); }
         }
@@ -25,19 +26,22 @@
         public event Action accountBindOkEvent;
 
         bool m_ReconnecBackGround = false;
-        public bool reconnectBackGround {
+        public bool reconnectBackGround
+        {
             get { return m_ReconnecBackGround; }
             set { m_ReconnecBackGround = value; }
         }
 
         bool m_OnCreateRole = false;
-        public bool onCreateRole {
+        public bool onCreateRole
+        {
             get { return m_OnCreateRole; }
             set { m_OnCreateRole = value; }
         }
 
         bool m_Busy = false;
-        public bool busy {
+        public bool busy
+        {
             get { return m_Busy; }
             set { m_Busy = value; }
         }
@@ -329,8 +333,27 @@
                     {
                         send.IDType = 6;
                     }
+                    else if (SDKUtility.Instance.ChannelPlatform == SDKUtility.E_ChannelPlatform.Xn)
+                    {
+                        send.IDType = 7;
+                        send.Extra += ("|" + SDKUtility.Yj_AppID + "|" + SDKUtility.Yj_Version);
+                        send.ExtraLen = (byte)send.Extra.Length;
+                    }
+                    else if (SDKUtility.Instance.ChannelPlatform == SDKUtility.E_ChannelPlatform.Cjm)
+                    {
+                        send.IDType = 8;
+                        send.Extra += ("|" + SDKUtility.Yj_AppID + "|" + SDKUtility.Instance.FreePlatformInfo.token);
+                        send.ExtraLen = (byte)send.Extra.Length;
+                    }
                     send.AccID = sdkLoginResult.account;
-                    send.Password = sdkLoginResult.token;
+                    if (SDKUtility.Instance.ChannelPlatform != SDKUtility.E_ChannelPlatform.Cjm)
+                    {
+                        send.Password = sdkLoginResult.token;
+                    }
+                    else
+                    {
+                        send.Password = "";
+                    }
                     send.MAC = DeviceUtility.GetMac();
                     send.Version = _serverInfo.Version;
                     send.LineNO = 255;
diff --git a/System/NewBieGuidance/NewBieCenter.cs b/System/NewBieGuidance/NewBieCenter.cs
index e3165ab..380fe28 100644
--- a/System/NewBieGuidance/NewBieCenter.cs
+++ b/System/NewBieGuidance/NewBieCenter.cs
@@ -198,7 +198,7 @@
         {
             var guideRecord = currentGuide;
             currentGuide = 0;
-            WindowCenter.Instance.Close<NewBieWin>();
+            WindowCenter.Instance.CloseImmediately("NewBieWin");
 
             if (!completeGuidesBuf.Contains(guideRecord))
             {
@@ -378,7 +378,7 @@
             GameNetSystem.Instance.SendInfo(send);
 
             currentGuide = 0;
-            WindowCenter.Instance.Close<NewBieWin>();
+            WindowCenter.Instance.CloseImmediately("NewBieWin");
 
             var allGuideKeys = GuideConfig.GetKeys();
             for (int i = 0; i < allGuideKeys.Count; i++)
@@ -396,7 +396,7 @@
             GameNetSystem.Instance.SendInfo(send);
 
             currentGuide = 0;
-            WindowCenter.Instance.Close<NewBieWin>();
+            WindowCenter.Instance.CloseImmediately("NewBieWin");
 
             completeGuidesBuf.Clear();
         }
diff --git a/System/Team/TeamModel.cs b/System/Team/TeamModel.cs
index 16cc96b..89f985f 100644
--- a/System/Team/TeamModel.cs
+++ b/System/Team/TeamModel.cs
@@ -629,6 +629,12 @@
 
         public void RequestPrepareEnterDungeon(bool _prepare)
         {
+            var crossServerOneVsOneModel = ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>();
+            if (crossServerOneVsOneModel.IsMatching)
+            {
+                crossServerOneVsOneModel.SendCrossMatch(0);
+            }
+
             var sendInfo = new CB909_tagCGTeamMemberPrepare();
             sendInfo.PrepareState = (byte)(_prepare ? 1 : 2);
             GameNetSystem.Instance.SendInfo(sendInfo);

--
Gitblit v1.8.0