From 4e196740debaffb8a79a014046e9dd530a450dd9 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期四, 18 十月 2018 21:43:06 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/OpenServerActivity/WishingPoolModel.cs      |   81 +++++++++++++
 System/OpenServerActivity/WishingPoolWin.cs        |  129 +++++++++++++++++++++
 System/OpenServerActivity/PoolItemCell.cs          |   42 +++++++
 System/OpenServerActivity/WishingPoolModel.cs.meta |   12 ++
 System/OpenServerActivity/WishingPoolWin.cs.meta   |   12 ++
 System/OpenServerActivity/PoolItemCell.cs.meta     |   12 ++
 System/Welfare/AwardExchangeWin.cs                 |   31 +++++
 Fight/Actor/AI/HeroAI_Base.cs                      |    2 
 8 files changed, 320 insertions(+), 1 deletions(-)

diff --git a/Fight/Actor/AI/HeroAI_Base.cs b/Fight/Actor/AI/HeroAI_Base.cs
index 1b34293..44c88de 100644
--- a/Fight/Actor/AI/HeroAI_Base.cs
+++ b/Fight/Actor/AI/HeroAI_Base.cs
@@ -173,7 +173,7 @@
     protected GActorFight DecideAttackTarget(Vector3 searchCenter, float range, int lockNpcID = -1)
     {
         GA_Hero _hero = PlayerDatas.Instance.hero;
-        GActorFight _target = _hero.SelectTarget as GActorFight;
+        GActorFight _target = _hero.LockTarget as GActorFight;
 
         if (_target == null || !_target.CanAtked())
         {
diff --git a/System/OpenServerActivity/PoolItemCell.cs b/System/OpenServerActivity/PoolItemCell.cs
new file mode 100644
index 0000000..27f33de
--- /dev/null
+++ b/System/OpenServerActivity/PoolItemCell.cs
@@ -0,0 +1,42 @@
+锘縰sing UnityEngine;
+using UnityEngine.EventSystems;
+using UnityEngine.UI;
+
+namespace Snxxz.UI
+{
+    public class PoolItemCell : MonoBehaviour,IDragHandler,IDropHandler
+    {
+        [SerializeField] CommonItemBaisc itemBaisc;
+        [SerializeField] GameObject bestIconObj;
+        
+        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
+        WishingPoolModel wishingModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
+        int itemId = 0;
+        public void OnDrag(PointerEventData eventData)
+        {
+            Debug.Log("鎷栨嫿寮�濮�");
+            wishingModel.isDraging = true;
+            wishingModel.dragItemId = itemId;
+        }
+
+        public void OnDrop(PointerEventData eventData)
+        {
+            Debug.Log("鎷栨嫿缁撴潫");
+            wishingModel.ResetDragData();
+        }
+
+        public void Display(int itemId)
+        {
+            this.itemId = itemId;
+            bestIconObj.SetActive(false);
+            ItemCellModel cellModel = new ItemCellModel(itemId);
+            itemBaisc.Init(cellModel);
+            itemBaisc.cellBtn.RemoveAllListeners();
+            itemBaisc.cellBtn.AddListener(()=>
+            {
+                ItemAttrData attrData = new ItemAttrData(itemId);
+                tipsModel.SetItemTipsModel(attrData);
+            });
+        }
+    }
+}
diff --git a/System/OpenServerActivity/PoolItemCell.cs.meta b/System/OpenServerActivity/PoolItemCell.cs.meta
new file mode 100644
index 0000000..0e60e62
--- /dev/null
+++ b/System/OpenServerActivity/PoolItemCell.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: cfb17095c4683604ab0d6ee15f706366
+timeCreated: 1539852829
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/OpenServerActivity/WishingPoolModel.cs b/System/OpenServerActivity/WishingPoolModel.cs
new file mode 100644
index 0000000..6bce174
--- /dev/null
+++ b/System/OpenServerActivity/WishingPoolModel.cs
@@ -0,0 +1,81 @@
+锘縰sing System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace Snxxz.UI
+{
+    public class WishingPoolModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk
+    {
+        public override void Init()
+        {
+            
+        }
+
+        public void OnBeforePlayerDataInitialize()
+        {
+            ResetDragData();
+            ResetPoolData();
+        }
+
+        public void OnPlayerLoginOk()
+        {
+            SetWishingPoolData();
+        }
+
+        public override void UnInit()
+        {
+            
+        }
+
+        #region 鏈湴鏁版嵁
+        public bool isDraging { get; set; }
+        public int dragItemId { get; set; }
+        public void ResetDragData()
+        {
+            isDraging = false;
+            dragItemId = 0;
+        }
+        #endregion
+
+        #region 鍗忚
+        Dictionary<int, int> poolDataDict = new Dictionary<int, int>();
+        public void SetWishingPoolData()
+        {
+            for(int i = 0; i< 8; i++)
+            {
+                int itemId = 10101 + i;
+                poolDataDict.Add(i,itemId);
+            }
+        }
+
+        Dictionary<int, int> wishingDataDict = new Dictionary<int, int>();
+        public void SetWishingData(int index,int id)
+        {
+            if(!wishingDataDict.ContainsKey(index))
+            {
+                wishingDataDict.Add(index,id);
+            }
+            else
+            {
+                wishingDataDict[index] = id;
+            }
+        }
+
+        public bool TryGetPoolDataByIndex(int index,out int id)
+        {
+           return  poolDataDict.TryGetValue(index,out id);
+        }
+
+        public bool TryGetWishDataByIndex(int index, out int id)
+        {
+            return wishingDataDict.TryGetValue(index, out id);
+        }
+        #endregion
+
+        public void ResetPoolData()
+        {
+            poolDataDict.Clear();
+            wishingDataDict.Clear();
+        }
+    }
+}
diff --git a/System/OpenServerActivity/WishingPoolModel.cs.meta b/System/OpenServerActivity/WishingPoolModel.cs.meta
new file mode 100644
index 0000000..d4cf340
--- /dev/null
+++ b/System/OpenServerActivity/WishingPoolModel.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 15695b2ce757fe2489989e1c5b8112c2
+timeCreated: 1539851881
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/OpenServerActivity/WishingPoolWin.cs b/System/OpenServerActivity/WishingPoolWin.cs
new file mode 100644
index 0000000..a7ad8d8
--- /dev/null
+++ b/System/OpenServerActivity/WishingPoolWin.cs
@@ -0,0 +1,129 @@
+锘縰sing UnityEngine;
+using UnityEngine.UI;
+using System.Collections.Generic;
+using System;
+
+namespace Snxxz.UI
+{
+    public class WishingPoolWin : Window
+    {
+        [SerializeField] DragItem dragItem;
+        [SerializeField] List<PoolItemCell> poolItemCells = new List<PoolItemCell>();
+        [SerializeField] List<WishingCell> wishingCells = new List<WishingCell>();
+
+        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
+        WishingPoolModel wishingModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
+        #region Built-in
+        protected override void BindController()
+        {
+
+        }
+
+        protected override void AddListeners()
+        {
+           
+        }
+
+        protected override void OnPreOpen()
+        {
+
+        }
+
+        protected override void OnAfterOpen()
+        {
+           
+        }
+        protected override void OnPreClose()
+        {
+            
+        }
+
+        protected override void OnAfterClose()
+        {
+
+        }
+        #endregion
+
+        private void Display()
+        {
+            UpdatePoolItem();
+            for(int i = 0; i < wishingCells.Count; i++)
+            {
+                UpdateWishItemByIndex(i);
+            }
+        }
+
+
+        protected override void LateUpdate()
+        {
+           if(wishingModel.isDraging)
+            {
+
+            }
+        }
+
+        private void UpdatePoolItem()
+        {
+            for (int i = 0; i < poolItemCells.Count; i++)
+            {
+                UpdatePoolItemByIndex(i);
+            }
+        }
+
+        private void UpdatePoolItemByIndex(int index)
+        {
+            int id = 0;
+            var poolItemCell = poolItemCells[index];
+            bool isPoolData = wishingModel.TryGetPoolDataByIndex(index, out id);
+            if (isPoolData)
+            {
+                poolItemCell.gameObject.SetActive(true);
+                poolItemCell.Display(id);
+            }
+            else
+            {
+                poolItemCell.gameObject.SetActive(false);
+            }
+        }
+
+        private void UpdateWishItemByIndex(int index)
+        {
+            int id = 0;
+            var wishCell = wishingCells[index];
+            bool isWishData = wishingModel.TryGetWishDataByIndex(index, out id);
+            if (isWishData)
+            {
+                wishCell.itemBaisc.gameObject.SetActive(true);
+                wishCell.noneItemObj.gameObject.SetActive(false);
+                ItemCellModel cellModel = new ItemCellModel(id);
+                wishCell.itemBaisc.Init(cellModel);
+                wishCell.itemBaisc.cellBtn.RemoveAllListeners();
+                wishCell.itemBaisc.cellBtn.AddListener(() =>
+                {
+                    ItemAttrData attrData = new ItemAttrData(id);
+                    tipsModel.SetItemTipsModel(attrData);
+                });
+            }
+            else
+            {
+                wishCell.itemBaisc.gameObject.SetActive(false);
+                wishCell.noneItemObj.gameObject.SetActive(true);
+            }
+        }
+
+        [Serializable]
+        public class WishingCell
+        {
+            public CommonItemBaisc itemBaisc;
+            public GameObject noneItemObj;
+            public Button noneItemBtn;
+        }
+
+        [Serializable]
+        public class DragItem
+        {
+            [SerializeField] CommonItemBaisc dragItemBasic;
+            [SerializeField] GameObject dragBestIcon;
+        }
+    }
+}
diff --git a/System/OpenServerActivity/WishingPoolWin.cs.meta b/System/OpenServerActivity/WishingPoolWin.cs.meta
new file mode 100644
index 0000000..a230c08
--- /dev/null
+++ b/System/OpenServerActivity/WishingPoolWin.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c258b8a747a14734ea67448bf5870305
+timeCreated: 1539851707
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/Welfare/AwardExchangeWin.cs b/System/Welfare/AwardExchangeWin.cs
index b9cacb5..1ff66a4 100644
--- a/System/Welfare/AwardExchangeWin.cs
+++ b/System/Welfare/AwardExchangeWin.cs
@@ -10,6 +10,8 @@
         [SerializeField] InputField input;
         [SerializeField] Button receiveBtn;
         const string exchangeUrl = "http://center.2460web.com:53003/Coupon/CouponCode.php?";
+        bool isCool = false;
+        float time = 0;
         protected override void BindController()
         {
 
@@ -22,6 +24,8 @@
 
         protected override void OnPreOpen()
         {
+            time = 0;
+            isCool = false;
             InitUI();
         }
         protected override void OnAfterOpen()
@@ -39,6 +43,19 @@
          
         }
 
+        protected override void LateUpdate()
+        {
+            if(isCool)
+            {
+                time += Time.deltaTime;
+                if(time >= 3)
+                {
+                    time = 0;
+                    isCool = false;
+                }
+            }
+        }
+
         private void InitUI()
         {
             input.text = string.Empty;
@@ -46,6 +63,8 @@
 
         private void ClickRecevieBtn()
         {
+            if (isCool) return;
+   
             string passward = input.text;
             if(string.IsNullOrEmpty(passward))
             {
@@ -54,6 +73,7 @@
             }
             else
             {
+                isCool = true;
                 var tables = new Dictionary<string, string>();
                 tables["channel"] = VersionConfig.Get().appId;
                 tables["code"] = passward;
@@ -61,8 +81,19 @@
                 tables["sid"] = ServerListCenter.Instance.currentServer.region_flag.ToString();
                 tables["pushurl"] = ServerListCenter.Instance.currentServer.region_domain;
                 tables["spid"] = VersionConfig.Get().SpID;
+                tables["roleid"] = UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName);
+                tables["level"] = PlayerDatas.Instance.baseData.LV.ToString();
+                tables["viplevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
                 HttpRequest.Instance.RequestHttpGet(StringUtility.Contact(exchangeUrl, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType, 1, null);
             }
+            if(passward.Length > 1)
+            {
+                string wxCode = passward.Substring(0, 2);
+                if (wxCode == "wx")
+                {
+                    WindowCenter.Instance.CloseImmediately<WelfareWin>();
+                }
+            }
         }
     }
 }

--
Gitblit v1.8.0