少年修仙传客户端代码仓库
Client_PangDeRong
2018-10-23 1da7f21efc5a47cd5ba866c58130824c39af346c
4232 【前端】许愿池功能开发
2个文件已添加
5个文件已修改
163 ■■■■■ 已修改文件
System/OpenServerActivity/PoolItemCell.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishGroupCell.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishItemCell.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishItemCell.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishingPoolModel.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishingPoolWin.cs 91 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/WishingWarehouseWin.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/OpenServerActivity/PoolItemCell.cs
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using TableConfig;
namespace Snxxz.UI
{
@@ -8,7 +9,7 @@
    {
        [SerializeField] CommonItemBaisc itemBaisc;
        [SerializeField] GameObject bestIconObj;
        [SerializeField] Text nameText;
        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
        WishingPoolModel wishingModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
        int index = -1;
@@ -24,6 +25,9 @@
            this.index = index;
            WishingPoolModel.WishingWellItem wellItem = null;
            bool isPoolData = wishingModel.TryGetPoolDataByIndex(index,out wellItem);
            ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(wellItem.itemId);
            nameText.text = itemConfig.ItemName;
            nameText.color = UIHelper.GetUIColor(itemConfig.ItemColor);
            bestIconObj.SetActive(false);
            ItemCellModel cellModel = new ItemCellModel(wellItem.itemId,false,(ulong)wellItem.itemCount,wellItem.isBind);
            itemBaisc.Init(cellModel);
System/OpenServerActivity/WishGroupCell.cs
@@ -2,6 +2,7 @@
using UnityEngine;
using UnityEngine.UI;
using System;
using TableConfig;
using System.Collections.Generic;
namespace Snxxz.UI
@@ -26,6 +27,9 @@
                {
                    poolItem.Object.SetActive(true);
                    var info = items[i];
                    ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(info.itemId);
                    poolItem.nameText.text = itemConfig.ItemName;
                    poolItem.nameText.color = UIHelper.GetUIColor(itemConfig.ItemColor);
                    ItemCellModel cellModel = new ItemCellModel(info.itemId,true,(ulong)info.itemCount,info.isBind);
                    poolItem.itemBaisc.Init(cellModel);
                    if(i == 0)
@@ -57,6 +61,7 @@
            public GameObject Object;
            public CommonItemBaisc itemBaisc;
            public GameObject bestImg;
            public Text nameText;
        }
    }
}
System/OpenServerActivity/WishItemCell.cs
New file
@@ -0,0 +1,44 @@
using UnityEngine;
using UnityEngine.UI;
using TableConfig;
namespace Snxxz.UI
{
    public class WishItemCell : MonoBehaviour
    {
        [SerializeField] CommonItemBaisc itemBaisc;
        [SerializeField] GameObject noneItemObj;
        [SerializeField] Button noneItemBtn;
        [SerializeField] Text nameText;
        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
        WishingPoolModel wishingModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
        public void Display(int index)
        {
            WishingPoolModel.WishingWellItem wellItem = null;
            bool isWishData = wishingModel.TryGetWishDataByIndex(index, out wellItem);
            if (isWishData)
            {
                nameText.gameObject.SetActive(true);
                itemBaisc.gameObject.SetActive(true);
                noneItemObj.gameObject.SetActive(false);
                ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(wellItem.itemId);
                nameText.text = itemConfig.ItemName;
                nameText.color = UIHelper.GetUIColor(itemConfig.ItemColor);
                ItemCellModel cellModel = new ItemCellModel(wellItem.itemId, false, (ulong)wellItem.itemCount, wellItem.isBind);
                itemBaisc.Init(cellModel);
                itemBaisc.cellBtn.RemoveAllListeners();
                itemBaisc.cellBtn.AddListener(() =>
                {
                    ItemAttrData attrData = new ItemAttrData(wellItem.itemId, true, (ulong)wellItem.itemCount, -1, wellItem.isBind);
                    tipsModel.SetItemTipsModel(attrData);
                });
            }
            else
            {
                itemBaisc.gameObject.SetActive(false);
                noneItemObj.gameObject.SetActive(true);
                nameText.gameObject.SetActive(false);
            }
        }
    }
}
System/OpenServerActivity/WishItemCell.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c37d2addeecee1b4d91b72098f044169
timeCreated: 1540260925
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
System/OpenServerActivity/WishingPoolModel.cs
@@ -120,6 +120,8 @@
            return false;
        }
        #region 本地数据
        public bool isDraging { get; set; }
        public int dragIndex { get; set; }
System/OpenServerActivity/WishingPoolWin.cs
@@ -10,11 +10,14 @@
        [SerializeField] DragItem dragItem;
        [SerializeField] Text activityDayText;
        [SerializeField] Text totalDayText;
        [SerializeField] Text dayRemainTime;
        [SerializeField] Button lookAllBtn;
        [SerializeField] Button refreshWishBtn;
        [SerializeField] Button freeRefreshWishBtn;
        [SerializeField] Button moneyRefreshWishBtn;
        [SerializeField] Text moneyValueText;
        [SerializeField] Text freeWishCoolText;
        [SerializeField] List<PoolItemCell> poolItemCells = new List<PoolItemCell>();
        [SerializeField] List<WishingCell> wishingCells = new List<WishingCell>();
        [SerializeField] List<WishItemCell> wishingCells = new List<WishItemCell>();
        [SerializeField] GameObject activityOpenObj;
        [SerializeField] GameObject activityCloseObj;
@@ -29,17 +32,18 @@
        protected override void AddListeners()
        {
            refreshWishBtn.AddListener(ClickRefreshWish);
            freeRefreshWishBtn.AddListener(ClickFreeRefreshWish);
            moneyRefreshWishBtn.AddListener(ClickMoneyRefreshWish);
            lookAllBtn.AddListener(ClickLook);
        }
        protected override void OnPreOpen()
        {
            Display();
            OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
            wishingModel.UpdatePoolDataEvent += UpdatePoolItemByIndex;
            wishingModel.UpdateWishingDataEvent += UpdateWishItemByIndex;
            GlobalTimeEvent.Instance.hourEvent += UpdateFreeWishCool;
            Display();
            GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
        }
        protected override void OnAfterOpen()
@@ -50,10 +54,9 @@
        {
            wishingModel.UpdatePoolDataEvent -= UpdatePoolItemByIndex;
            wishingModel.UpdateWishingDataEvent -= UpdateWishItemByIndex;
            GlobalTimeEvent.Instance.hourEvent -= UpdateFreeWishCool;
            GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
            OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
        }
        protected override void OnAfterClose()
        {
@@ -73,8 +76,9 @@
            dragItem.dragItemRect.gameObject.SetActive(false);
            UpdateFreeWishCool();
            UpdateActivityState();
            activityDayText.text = Language.Get("SignIn_4", Language.Get(StringUtility.Contact("Num_CHS_", operation.GetActivityDay())));
            totalDayText.text = StringUtility.Contact("活动持续", Language.Get(StringUtility.Contact("Num_CHS_",operation.totalDays + 1)), "天");
            UpdateDayRemainTime();
            activityDayText.text = Language.Get("WishingPool103", Language.Get(StringUtility.Contact("Num_CHS_", operation.GetActivityDay())));
            totalDayText.text = Language.Get("WishingPool101", Language.Get(StringUtility.Contact("Num_CHS_", operation.totalDays + 1)));
        }
        #region 许愿逻辑
@@ -105,7 +109,7 @@
        {
            for(int i = 0; i < wishingCells.Count; i++)
            {
                var rect = wishingCells[i].wishRect;
                var rect = wishingCells[i].transform as RectTransform;
                var des = RectTransformUtility.CalculateRelativeRectTransformBounds(this.transform, rect);
                var src = RectTransformUtility.CalculateRelativeRectTransformBounds(this.transform, dragItem.dragItemRect);
                var dis = Vector3.Distance(des.center, src.center);
@@ -174,36 +178,8 @@
        private void UpdateWishItemByIndex(int index)
        {
            WishingPoolModel.WishingWellItem wellItem = null;
            var wishCell = wishingCells[index];
            bool isWishData = wishingModel.TryGetWishDataByIndex(index, out wellItem);
            if (isWishData)
            {
                wishCell.itemBaisc.gameObject.SetActive(true);
                wishCell.noneItemObj.gameObject.SetActive(false);
                ItemCellModel cellModel = new ItemCellModel(wellItem.itemId, false, (ulong)wellItem.itemCount, wellItem.isBind);
                wishCell.itemBaisc.Init(cellModel);
                wishCell.itemBaisc.cellBtn.RemoveAllListeners();
                wishCell.itemBaisc.cellBtn.AddListener(() =>
                {
                    ItemAttrData attrData = new ItemAttrData(wellItem.itemId, true, (ulong)wellItem.itemCount,-1,wellItem.isBind);
                    tipsModel.SetItemTipsModel(attrData);
                });
            }
            else
            {
                wishCell.itemBaisc.gameObject.SetActive(false);
                wishCell.noneItemObj.gameObject.SetActive(true);
            }
        }
        [Serializable]
        public class WishingCell
        {
            public RectTransform wishRect;
            public CommonItemBaisc itemBaisc;
            public GameObject noneItemObj;
            public Button noneItemBtn;
            wishCell.Display(index);
        }
        [Serializable]
@@ -224,18 +200,37 @@
            }
        }
        private void UpdateSecond()
        {
            if (operation == null) return;
            UpdateFreeWishCool();
            UpdateDayRemainTime();
        }
        private void UpdateDayRemainTime()
        {
            dayRemainTime.text = Language.Get("WishingPool104", TimeUtility.SecondsToHMS(operation.GetResetSurplusTime()));
        }
        private void UpdateFreeWishCool()
        {
            int second = 0;
            bool isCool = wishingModel.TryGetFreeWishCoolTime(out second);
            if (isCool)
            {
                freeRefreshWishBtn.gameObject.SetActive(false);
                freeWishCoolText.gameObject.SetActive(true);
                freeWishCoolText.text = TimeUtility.SecondsToHMS(second);
                moneyRefreshWishBtn.gameObject.SetActive(true);
                moneyValueText.text = "100";
                freeWishCoolText.text = Language.Get("WishingPool102", TimeUtility.SecondsToHMS(second));
            }
            else
            {
                freeRefreshWishBtn.gameObject.SetActive(true);
                freeWishCoolText.gameObject.SetActive(false);
                moneyRefreshWishBtn.gameObject.SetActive(false);
            }
        }
@@ -259,18 +254,14 @@
            WindowCenter.Instance.Open<WishingWarehouseWin>();
        }
        private void ClickRefreshWish()
        private void ClickMoneyRefreshWish()
        {
            int second = 0;
            bool isCool = wishingModel.TryGetFreeWishCoolTime(out second);
            if(isCool)
            {
            wishingModel.SendRefreshPoolInfo(0);
        }
            }
            else
            {
            }
        private void ClickFreeRefreshWish()
        {
            wishingModel.SendRefreshPoolInfo(1);
        }
        #endregion
System/OpenServerActivity/WishingWarehouseWin.cs
@@ -6,6 +6,7 @@
{
    public class WishingWarehouseWin : Window
    {
        [SerializeField] Button closeBtn;
        [SerializeField] ScrollerController wishGroupCtrl;
        WishingPoolModel wishModel { get { return ModelCenter.Instance.GetModel<WishingPoolModel>(); } }
        protected override void BindController()
@@ -15,7 +16,7 @@
        protected override void AddListeners()
        {
            closeBtn.AddListener(CloseClick);
        }
        protected override void OnPreOpen()