少年修仙传客户端代码仓库
client_linchunjie
2018-10-18 4e196740debaffb8a79a014046e9dd530a450dd9
Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
2个文件已修改
6个文件已添加
321 ■■■■■ 已修改文件
Fight/Actor/AI/HeroAI_Base.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/PoolItemCell.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/PoolItemCell.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishingPoolModel.cs 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishingPoolModel.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishingPoolWin.cs 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishingPoolWin.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Welfare/AwardExchangeWin.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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())
        {
System/OpenServerActivity/PoolItemCell.cs
New file
@@ -0,0 +1,42 @@
using 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);
            });
        }
    }
}
System/OpenServerActivity/PoolItemCell.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: cfb17095c4683604ab0d6ee15f706366
timeCreated: 1539852829
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/OpenServerActivity/WishingPoolModel.cs
New file
@@ -0,0 +1,81 @@
using 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();
        }
    }
}
System/OpenServerActivity/WishingPoolModel.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 15695b2ce757fe2489989e1c5b8112c2
timeCreated: 1539851881
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/OpenServerActivity/WishingPoolWin.cs
New file
@@ -0,0 +1,129 @@
using 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;
        }
    }
}
System/OpenServerActivity/WishingPoolWin.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c258b8a747a14734ea67448bf5870305
timeCreated: 1539851707
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
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>();
                }
            }
        }
    }
}