Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3e05761d690b75440a6be79207d0fb01 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1d70ccd06161e0443b7a802ad94292f8 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 71e878ac60c49ad4f964dd2dbc725739 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: eed34091b0568664b9fb42f0634496c1 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public ServerType socketType;
|
| | | public bool show = false;
|
| | | public string time;
|
| | | public string serverTime;
|
| | | public string content;
|
| | | public string name;
|
| | | public NetPackagetType type;
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 32ceb8b7faf99f84a8b73ce53c5e3e4d |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 77f69c2b862d1704299a32d0d8eeb71e |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fa14960fa44b0d1439bab471a764e34f |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d914565b65f8e8145988734c4d915834 |
| | | folderAsset: yes |
| | | timeCreated: 1547643019 |
| | | licenseType: Pro |
| | | DefaultImporter: |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public static void __Register(RealStatePtr L) |
| | | { |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | System.Type type = typeof(BuyItemPopModel); |
| | | System.Type type = typeof(BuyItemController); |
| | | Utils.BeginObjectRegister(type, L, translator, 0, 6, 2, 1); |
| | | |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetModel", _m_SetModel); |
| | |
| | | if(LuaAPI.lua_gettop(L) == 1) |
| | | { |
| | | |
| | | BuyItemPopModel gen_ret = new BuyItemPopModel(); |
| | | BuyItemController gen_ret = new BuyItemController(); |
| | | translator.Push(L, gen_ret); |
| | | |
| | | return 1; |
| | |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | |
| | | BuyItemPopModel gen_to_be_invoked = (BuyItemPopModel)translator.FastGetCSObj(L, 1); |
| | | BuyItemController gen_to_be_invoked = (BuyItemController)translator.FastGetCSObj(L, 1); |
| | | |
| | | |
| | | |
| | |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | |
| | | BuyItemPopModel gen_to_be_invoked = (BuyItemPopModel)translator.FastGetCSObj(L, 1); |
| | | BuyItemController gen_to_be_invoked = (BuyItemController)translator.FastGetCSObj(L, 1); |
| | | |
| | | |
| | | |
| | |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | |
| | | BuyItemPopModel gen_to_be_invoked = (BuyItemPopModel)translator.FastGetCSObj(L, 1); |
| | | BuyItemController gen_to_be_invoked = (BuyItemController)translator.FastGetCSObj(L, 1); |
| | | |
| | | |
| | | |
| | |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | |
| | | BuyItemPopModel gen_to_be_invoked = (BuyItemPopModel)translator.FastGetCSObj(L, 1); |
| | | BuyItemController gen_to_be_invoked = (BuyItemController)translator.FastGetCSObj(L, 1); |
| | | |
| | | |
| | | |
| | |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | |
| | | BuyItemPopModel gen_to_be_invoked = (BuyItemPopModel)translator.FastGetCSObj(L, 1); |
| | | BuyItemController gen_to_be_invoked = (BuyItemController)translator.FastGetCSObj(L, 1); |
| | | |
| | | |
| | | |
| | |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | |
| | | BuyItemPopModel gen_to_be_invoked = (BuyItemPopModel)translator.FastGetCSObj(L, 1); |
| | | BuyItemController gen_to_be_invoked = (BuyItemController)translator.FastGetCSObj(L, 1); |
| | | |
| | | |
| | | |
| | |
| | | try { |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | BuyItemPopModel gen_to_be_invoked = (BuyItemPopModel)translator.FastGetCSObj(L, 1); |
| | | BuyItemController gen_to_be_invoked = (BuyItemController)translator.FastGetCSObj(L, 1); |
| | | translator.Push(L, gen_to_be_invoked.storeConfig); |
| | | } catch(System.Exception gen_e) { |
| | | return LuaAPI.luaL_error(L, "c# exception:" + gen_e); |
| | |
| | | try { |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | BuyItemPopModel gen_to_be_invoked = (BuyItemPopModel)translator.FastGetCSObj(L, 1); |
| | | BuyItemController gen_to_be_invoked = (BuyItemController)translator.FastGetCSObj(L, 1); |
| | | translator.Push(L, gen_to_be_invoked.vipBuyCntDict); |
| | | } catch(System.Exception gen_e) { |
| | | return LuaAPI.luaL_error(L, "c# exception:" + gen_e); |
| | |
| | | try { |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | BuyItemPopModel gen_to_be_invoked = (BuyItemPopModel)translator.FastGetCSObj(L, 1); |
| | | BuyItemController gen_to_be_invoked = (BuyItemController)translator.FastGetCSObj(L, 1); |
| | | gen_to_be_invoked.vipBuyCntDict = (System.Collections.Generic.Dictionary<int, int>)translator.GetObject(L, 2, typeof(System.Collections.Generic.Dictionary<int, int>)); |
| | | |
| | | } catch(System.Exception gen_e) { |
| | |
| | | translator.DelayWrapLoader(typeof(CoroutineMgr), CoroutineMgrWrap.__Register); |
| | | |
| | | |
| | | translator.DelayWrapLoader(typeof(BuyItemPopModel), BuyItemPopModelWrap.__Register); |
| | | translator.DelayWrapLoader(typeof(BuyItemController), BuyItemPopModelWrap.__Register); |
| | | |
| | | |
| | | translator.DelayWrapLoader(typeof(Snxxz.UI.BuySuccessModel), SnxxzUIBuySuccessModelWrap.__Register); |
| | |
| | | int addBuyCnt = 0;
|
| | | int curVipIndex = -1;
|
| | | int nextVipIndex = -1;
|
| | | bool isVipBuy = BuyItemPopModel.Instance.CheckIsVipBuy(storeConfig, out curVipIndex, out nextVipIndex);
|
| | | bool isLimitBuy = BuyItemPopModel.Instance.CheckIsLimitBuyCnt(storeConfig, out canBuyCnt, out addBuyCnt);
|
| | | bool isVipBuy = BuyItemController.Instance.CheckIsVipBuy(storeConfig, out curVipIndex, out nextVipIndex);
|
| | | bool isLimitBuy = BuyItemController.Instance.CheckIsLimitBuyCnt(storeConfig, out canBuyCnt, out addBuyCnt);
|
| | | bool isShowBuyPrice = true;
|
| | | if(isVipBuy)
|
| | | {
|
| | |
| | | itemCell.Init(cellModel);
|
| | | int canBuyCnt = 0;
|
| | | int addBuyCnt = 0;
|
| | | bool isLimitBuy = BuyItemPopModel.Instance.CheckIsLimitBuyCnt(storeConfig, out canBuyCnt, out addBuyCnt);
|
| | | bool isLimitBuy = BuyItemController.Instance.CheckIsLimitBuyCnt(storeConfig, out canBuyCnt, out addBuyCnt);
|
| | | if (canBuyCnt > 0)
|
| | | {
|
| | | itemCell.countText.gameObject.SetActive(true);
|
| | |
| | | { |
| | | public int itemId; |
| | | public string guid; |
| | | public int goodId; |
| | | |
| | | public BaseInfo baseInfo; |
| | | public BaseProperty baseProperty; |
| | |
| | | public int count; |
| | | public bool isAuction; |
| | | public bool isEquiped; |
| | | public bool isPreview; |
| | | |
| | | public int star; |
| | | public int strengthenLevel; |
| | |
| | | static MountModel mountModel { get { return ModelCenter.Instance.GetModel<MountModel>(); } } |
| | | static PetModel petModel { get { return ModelCenter.Instance.GetModel<PetModel>(); } } |
| | | static ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } } |
| | | static StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } |
| | | |
| | | public static TipType tipType { get; private set; } |
| | | public static TipData mainTipData { get; private set; } |
| | | public static TipData secondaryData { get; private set; } |
| | | |
| | | public static void Show(int itemId, TipType type = TipType.Normal) |
| | | public static void Show(int itemId) |
| | | { |
| | | tipType = type; |
| | | secondaryData = null; |
| | | |
| | | var isEquip = ItemLogicUtility.Instance.IsEquip(itemId); |
| | |
| | | } |
| | | |
| | | var config = ItemConfig.Get(itemId); |
| | | switch (type) |
| | | if (isEquip) |
| | | { |
| | | case TipType.Normal: |
| | | if (isEquip) |
| | | { |
| | | WindowCenter.Instance.Open<EquipTipWin>(); |
| | | } |
| | | else |
| | | { |
| | | switch (config.Type) |
| | | { |
| | | case 26: |
| | | case 41: |
| | | case 42: |
| | | WindowCenter.Instance.Open<PetMountTipWin>(); |
| | | break; |
| | | case 113: |
| | | WindowCenter.Instance.Open<WingTipWin>(); |
| | | break; |
| | | case 114: |
| | | WindowCenter.Instance.Open<GuardTipWin>(); |
| | | break; |
| | | default: |
| | | WindowCenter.Instance.Open<ItemTipWin>(); |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | case TipType.Good: |
| | | WindowCenter.Instance.Open<GoodTipWin>(); |
| | | break; |
| | | WindowCenter.Instance.Open<EquipTipWin>(); |
| | | } |
| | | else |
| | | { |
| | | switch (config.Type) |
| | | { |
| | | case 26: |
| | | case 41: |
| | | case 42: |
| | | WindowCenter.Instance.Open<PetMountTipWin>(); |
| | | break; |
| | | case 113: |
| | | WindowCenter.Instance.Open<WingTipWin>(); |
| | | break; |
| | | case 114: |
| | | WindowCenter.Instance.Open<GuardTipWin>(); |
| | | break; |
| | | default: |
| | | WindowCenter.Instance.Open<ItemTipWin>(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | break; |
| | | } |
| | | |
| | | switch (tipType) |
| | | if (isEquip) |
| | | { |
| | | case TipType.Normal: |
| | | if (isEquip) |
| | | { |
| | | WindowCenter.Instance.Open<EquipTipWin>(); |
| | | } |
| | | else |
| | | { |
| | | switch (item.config.Type) |
| | | { |
| | | case 26: |
| | | case 41: |
| | | case 42: |
| | | WindowCenter.Instance.Open<PetMountTipWin>(); |
| | | break; |
| | | case 113: |
| | | WindowCenter.Instance.Open<WingTipWin>(); |
| | | break; |
| | | case 114: |
| | | WindowCenter.Instance.Open<GuardTipWin>(); |
| | | break; |
| | | default: |
| | | WindowCenter.Instance.Open<ItemTipWin>(); |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | case TipType.Good: |
| | | WindowCenter.Instance.Open<GoodTipWin>(); |
| | | break; |
| | | WindowCenter.Instance.Open<EquipTipWin>(); |
| | | } |
| | | else |
| | | { |
| | | switch (item.config.Type) |
| | | { |
| | | case 26: |
| | | case 41: |
| | | case 42: |
| | | WindowCenter.Instance.Open<PetMountTipWin>(); |
| | | break; |
| | | case 113: |
| | | WindowCenter.Instance.Open<WingTipWin>(); |
| | | break; |
| | | case 114: |
| | | WindowCenter.Instance.Open<GuardTipWin>(); |
| | | break; |
| | | default: |
| | | WindowCenter.Instance.Open<ItemTipWin>(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void ShowGood(int goodId, int itemId) |
| | | { |
| | | secondaryData = null; |
| | | |
| | | var isEquip = ItemLogicUtility.Instance.IsEquip(itemId); |
| | | if (isEquip) |
| | | { |
| | | mainTipData = CreateGoodEquipData(itemId, goodId); |
| | | } |
| | | else |
| | | { |
| | | mainTipData = CreateGoodItemData(itemId, goodId); |
| | | } |
| | | |
| | | var itemConfig = ItemConfig.Get(itemId); |
| | | if (isEquip) |
| | | { |
| | | WindowCenter.Instance.Open<EquipTipWin>(); |
| | | } |
| | | else |
| | | { |
| | | switch (itemConfig.Type) |
| | | { |
| | | case 26: |
| | | case 41: |
| | | case 42: |
| | | WindowCenter.Instance.Open<PetMountTipWin>(); |
| | | break; |
| | | case 113: |
| | | WindowCenter.Instance.Open<WingTipWin>(); |
| | | break; |
| | | case 114: |
| | | WindowCenter.Instance.Open<GuardTipWin>(); |
| | | break; |
| | | default: |
| | | WindowCenter.Instance.Open<ItemTipWin>(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | gemInfo = GetGemInfo(itemId), |
| | | starInfo = GetStarInfo(itemId), |
| | | getWay = GetGetWay(itemId) |
| | | }; |
| | | } |
| | | |
| | | static TipData CreateGoodEquipData(int itemId, int goodId) |
| | | { |
| | | return new TipData() |
| | | { |
| | | itemId = itemId, |
| | | guid = string.Empty, |
| | | goodId = goodId, |
| | | |
| | | baseInfo = GetBaseInfo(itemId), |
| | | baseProperty = GetBaseProperty(itemId), |
| | | legendProperty = GetLegendProperty(itemId), |
| | | skillInfo = GetSkillInfo(itemId), |
| | | suitInfo = GetSuitInfo(itemId), |
| | | gemInfo = GetGemInfo(itemId), |
| | | starInfo = GetStarInfo(itemId), |
| | | operates = GetGoodOperates(goodId) |
| | | }; |
| | | } |
| | | |
| | |
| | | baseProperty = GetBaseProperty(itemId), |
| | | legendProperty = GetLegendProperty(itemId), |
| | | petMountBaseProperty = GetPetMountBaseProperty(itemId), |
| | | getWay = GetGetWay(itemId) |
| | | getWay = GetGetWay(itemId), |
| | | }; |
| | | } |
| | | |
| | | static TipData CreateGoodItemData(int itemId, int goodId) |
| | | { |
| | | return new TipData() |
| | | { |
| | | itemId = itemId, |
| | | goodId = goodId, |
| | | baseInfo = GetBaseInfo(itemId), |
| | | baseProperty = GetBaseProperty(itemId), |
| | | legendProperty = GetLegendProperty(itemId), |
| | | petMountBaseProperty = GetPetMountBaseProperty(itemId), |
| | | operates = GetGoodOperates(goodId), |
| | | }; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | public static void GoodOperate(ItemOperateType type, int goodId, int count) |
| | | { |
| | | var config = StoreConfig.Get(goodId); |
| | | storeModel.SendBuyShopItem(config, count); |
| | | } |
| | | |
| | | private static BaseInfo GetBaseInfo(int itemId) |
| | | { |
| | | var config = ItemConfig.Get(itemId); |
| | |
| | | itemId = itemId, |
| | | isAuction = false, |
| | | isEquiped = false, |
| | | isPreview = true, |
| | | score = ItemLogicUtility.Instance.GetEquipScore(PackType.Item, itemId, null, true), |
| | | auctionSurplusTime = 0, |
| | | levelLimit = config.UseLV, |
| | |
| | | count = item.count, |
| | | isAuction = item.isAuction, |
| | | isEquiped = isEquiped, |
| | | isPreview = false, |
| | | score = item.score, |
| | | auctionSurplusTime = item.isAuction ? item.auctionSurplusTime : 0, |
| | | overdueSurplusTime = item.overdueSurplusTime, |
| | |
| | | return operates; |
| | | } |
| | | |
| | | private static List<ItemOperateType> GetGoodOperates(int goodId) |
| | | { |
| | | var operates = new List<ItemOperateType>(); |
| | | var countLimit = BuyItemController.Instance.GetBuyCountLimit(goodId, PlayerDatas.Instance.baseData.VIPLv); |
| | | if (countLimit == -1 || countLimit > 0) |
| | | { |
| | | operates.Add(ItemOperateType.buy); |
| | | } |
| | | |
| | | return operates; |
| | | } |
| | | |
| | | private static bool IsEquipGemHoleOpen(Int2 equipPosition, int maxStar, int hole) |
| | | { |
| | | GemHoleCondition condition; |
| | |
| | | [SerializeField] WidgetGroup m_MainWidgetGroup; |
| | | [SerializeField] WidgetGroup m_SecondaryWidgetGroup; |
| | | |
| | | [SerializeField] OperateButton[] m_OpreateButtons; |
| | | [SerializeField] TipOperateButton[] m_OpreateButtons; |
| | | [SerializeField] Button m_Close; |
| | | |
| | | #region Built-in |
| | |
| | | if (i < operates.Count) |
| | | { |
| | | button.SetActive(true); |
| | | button.Bind(operates[i], guid); |
| | | button.Bind("EquipTipWin", operates[i], guid); |
| | | } |
| | | else |
| | | { |
| | |
| | | public TipJobAndPlaceWidget jobAndPlaceWidget; |
| | | public TipGetWayEntranceWidget getWayEntranceWidget; |
| | | public TipGetWaysWidget getWaysWidget; |
| | | public TipBuyItemWidget buyItemWidget; |
| | | |
| | | public void SetActive(bool active) |
| | | { |
| | |
| | | |
| | | jobAndPlaceWidget.Display(data.itemId); |
| | | |
| | | if (buyItemWidget != null) |
| | | { |
| | | buyItemWidget.gameObject.SetActive(data.goodId > 0); |
| | | if (data.goodId > 0) |
| | | { |
| | | buyItemWidget.Display(data.goodId); |
| | | } |
| | | } |
| | | |
| | | if (getWayEntranceWidget != null && getWaysWidget != null) |
| | | { |
| | | var getWay = EquipTipUtility.mainTipData.getWay; |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | [Serializable] |
| | | public class OperateButton |
| | | { |
| | | public RectTransform container; |
| | | public Button button; |
| | | public Text title; |
| | | |
| | | ItemOperateType operateType; |
| | | string guid; |
| | | |
| | | public void SetActive(bool active) |
| | | { |
| | | container.gameObject.SetActive(active); |
| | | } |
| | | |
| | | public void Bind(ItemOperateType type, string guid) |
| | | { |
| | | operateType = type; |
| | | this.guid = guid; |
| | | switch (type) |
| | | { |
| | | case ItemOperateType.putOn: |
| | | this.title.text = "穿上"; |
| | | break; |
| | | case ItemOperateType.putOff: |
| | | this.title.text = "脱下"; |
| | | break; |
| | | case ItemOperateType.putAway: |
| | | this.title.text = "上架"; |
| | | break; |
| | | case ItemOperateType.strength: |
| | | this.title.text = "强化"; |
| | | break; |
| | | case ItemOperateType.star: |
| | | this.title.text = "升星"; |
| | | break; |
| | | case ItemOperateType.inlay: |
| | | this.title.text = "镶嵌"; |
| | | break; |
| | | case ItemOperateType.train: |
| | | this.title.text = "洗炼"; |
| | | break; |
| | | case ItemOperateType.sell: |
| | | this.title.text = "出售"; |
| | | break; |
| | | case ItemOperateType.putOut: |
| | | this.title.text = "取出"; |
| | | break; |
| | | case ItemOperateType.putIn: |
| | | this.title.text = "放入"; |
| | | break; |
| | | default: |
| | | this.title.text = ""; |
| | | break; |
| | | } |
| | | |
| | | button.SetListener(() => |
| | | { |
| | | WindowCenter.Instance.Close<EquipTipWin>(); |
| | | EquipTipUtility.Operate(operateType, this.guid); |
| | | }); |
| | | } |
| | | |
| | | } |
| | |
| | | [SerializeField] TipItemBaseInfoWidget m_BaseInfoWidget; |
| | | [SerializeField] TipBasePropertyWidget m_BasePropertyWidget; |
| | | [SerializeField] TipItemDescriptionWidget m_DescriptionWidget; |
| | | [SerializeField] TipBuyItemWidget m_BuyItemWidget; |
| | | [SerializeField] TipGetWayEntranceWidget m_GetWayEntranceWidget; |
| | | [SerializeField] TipGetWaysWidget m_GetWaysWidget; |
| | | [SerializeField] TipJobAndPlaceWidget m_JobAndPlaceWidget; |
| | | [SerializeField] OperateButton[] m_OperateButtons; |
| | | [SerializeField] TipOperateButton[] m_OperateButtons; |
| | | [SerializeField] Button m_Close; |
| | | |
| | | #region Built-in |
| | |
| | | DisplayBaseInfo(); |
| | | DisplayBaseProperty(); |
| | | DisplayItemDescription(); |
| | | DisplayBuyItem(); |
| | | DisplayJobAndPlace(); |
| | | DisplayGetWays(); |
| | | DisplayOperateButton(); |
| | |
| | | { |
| | | var itemId = EquipTipUtility.mainTipData.baseInfo.itemId; |
| | | m_DescriptionWidget.Display(itemId); |
| | | } |
| | | |
| | | private void DisplayBuyItem() |
| | | { |
| | | m_BuyItemWidget.gameObject.SetActive(EquipTipUtility.mainTipData.goodId > 0); |
| | | if (EquipTipUtility.mainTipData.goodId > 0) |
| | | { |
| | | m_BuyItemWidget.Display(EquipTipUtility.mainTipData.goodId); |
| | | } |
| | | } |
| | | |
| | | private void DisplayGetWays() |
| | |
| | | if (i < operates.Count) |
| | | { |
| | | button.SetActive(true); |
| | | button.Bind(operates[i], guid); |
| | | button.Bind("GuardTipWin", operates[i], guid); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | [Serializable] |
| | | public class OperateButton |
| | | { |
| | | [SerializeField] RectTransform m_Container; |
| | | [SerializeField] Button m_Button; |
| | | [SerializeField] Text m_Title; |
| | | |
| | | ItemOperateType operateType; |
| | | string guid; |
| | | |
| | | public void SetActive(bool active) |
| | | { |
| | | this.m_Container.gameObject.SetActive(active); |
| | | } |
| | | |
| | | public void Bind(ItemOperateType type, string guid) |
| | | { |
| | | operateType = type; |
| | | this.guid = guid; |
| | | switch (type) |
| | | { |
| | | case ItemOperateType.putOn: |
| | | this.m_Title.text = "穿上"; |
| | | break; |
| | | case ItemOperateType.putOff: |
| | | this.m_Title.text = "脱下"; |
| | | break; |
| | | case ItemOperateType.sell: |
| | | this.m_Title.text = "出售"; |
| | | break; |
| | | case ItemOperateType.putOut: |
| | | this.m_Title.text = "取出"; |
| | | break; |
| | | case ItemOperateType.putIn: |
| | | this.m_Title.text = "放入"; |
| | | break; |
| | | default: |
| | | this.m_Title.text = ""; |
| | | break; |
| | | } |
| | | |
| | | m_Button.SetListener(() => |
| | | { |
| | | WindowCenter.Instance.Close<GuardTipWin>(); |
| | | EquipTipUtility.Operate(operateType, this.guid); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | [SerializeField] TipItemDescriptionWidget m_DescriptionWidget; |
| | | [SerializeField] TipAuctionTipWidget m_AuctionWidget; |
| | | [SerializeField] TipModelWidget m_ModelWidget; |
| | | [SerializeField] TipBuyItemWidget m_BuyItemWidget; |
| | | [SerializeField] TipGetWayEntranceWidget m_GetWayEntranceWidget; |
| | | [SerializeField] TipGetWaysWidget m_GetWaysWidget; |
| | | |
| | | [SerializeField] OperateButton[] m_OperateButtons; |
| | | [SerializeField] TipOperateButton[] m_OperateButtons; |
| | | |
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } } |
| | | |
| | |
| | | DisplayItemDescription(); |
| | | DisplayItemUseState(); |
| | | DisplayAuctionInfo(); |
| | | DisplayBuyItem(); |
| | | DisplayGetWays(); |
| | | DisplayOperateButton(); |
| | | DisplayModel(); |
| | |
| | | |
| | | } |
| | | |
| | | private void DisplayBuyItem() |
| | | { |
| | | m_BuyItemWidget.gameObject.SetActive(EquipTipUtility.mainTipData.goodId > 0); |
| | | if (EquipTipUtility.mainTipData.goodId > 0) |
| | | { |
| | | m_BuyItemWidget.Display(EquipTipUtility.mainTipData.goodId); |
| | | } |
| | | } |
| | | |
| | | private void DisplayGetWays() |
| | | { |
| | | var getWay = EquipTipUtility.mainTipData.getWay; |
| | |
| | | if (i < operates.Count) |
| | | { |
| | | button.SetActive(true); |
| | | button.Bind(operates[i], guid); |
| | | button.Bind("ItemTipWin", operates[i], guid); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | [Serializable] |
| | | public class OperateButton |
| | | { |
| | | [SerializeField] RectTransform m_Container; |
| | | [SerializeField] Button m_Button; |
| | | [SerializeField] Text m_Title; |
| | | |
| | | ItemOperateType operateType; |
| | | string guid; |
| | | |
| | | public void SetActive(bool active) |
| | | { |
| | | this.m_Container.gameObject.SetActive(active); |
| | | } |
| | | |
| | | public void Bind(ItemOperateType type, string guid) |
| | | { |
| | | operateType = type; |
| | | this.guid = guid; |
| | | switch (type) |
| | | { |
| | | case ItemOperateType.putAway: |
| | | this.m_Title.text = "上架"; |
| | | break; |
| | | case ItemOperateType.sell: |
| | | this.m_Title.text = "出售"; |
| | | break; |
| | | case ItemOperateType.makeUse: |
| | | this.m_Title.text = "使用"; |
| | | break; |
| | | case ItemOperateType.split: |
| | | this.m_Title.text = "拆分"; |
| | | break; |
| | | case ItemOperateType.inlay: |
| | | this.m_Title.text = "镶嵌"; |
| | | break; |
| | | case ItemOperateType.putOut: |
| | | this.m_Title.text = "取出"; |
| | | break; |
| | | case ItemOperateType.putIn: |
| | | this.m_Title.text = "放入"; |
| | | break; |
| | | case ItemOperateType.compose: |
| | | this.m_Title.text = "合成"; |
| | | break; |
| | | default: |
| | | this.m_Title.text = ""; |
| | | break; |
| | | } |
| | | |
| | | m_Button.SetListener(() => |
| | | { |
| | | WindowCenter.Instance.Close<ItemTipWin>(); |
| | | EquipTipUtility.Operate(operateType, this.guid); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | [SerializeField] TipPetMountSkillWidget m_PetMountSkill; |
| | | [SerializeField] TipAuctionTipWidget m_AuctionWidget; |
| | | [SerializeField] TipPetMountDescriptionWidget m_DescriptionWidget; |
| | | [SerializeField] TipBuyItemWidget m_BuyItemWidget; |
| | | [SerializeField] TipGetWayEntranceWidget m_GetWayEntranceWidget; |
| | | [SerializeField] TipGetWaysWidget m_GetWaysWidget; |
| | | [SerializeField] TipModelWidget m_Model; |
| | | [SerializeField] OperateButton[] m_OperateButtons; |
| | | [SerializeField] TipOperateButton[] m_OperateButtons; |
| | | |
| | | [SerializeField] Button m_Close; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void DisplayBuyItem() |
| | | { |
| | | m_BuyItemWidget.gameObject.SetActive(EquipTipUtility.mainTipData.goodId > 0); |
| | | if (EquipTipUtility.mainTipData.goodId > 0) |
| | | { |
| | | m_BuyItemWidget.Display(EquipTipUtility.mainTipData.goodId); |
| | | } |
| | | } |
| | | |
| | | private void DisplayModel() |
| | | { |
| | | var baseInfo = EquipTipUtility.mainTipData.baseInfo; |
| | |
| | | if (i < operates.Count) |
| | | { |
| | | button.SetActive(true); |
| | | button.Bind(operates[i], guid); |
| | | button.Bind("PetMountTipWin", operates[i], guid); |
| | | } |
| | | else |
| | | { |
| | |
| | | DisplaySkills(); |
| | | DisplayAuctionInfo(); |
| | | DisplayDescription(); |
| | | DisplayBuyItem(); |
| | | DisplayGetWays(); |
| | | DisplayModel(); |
| | | DisplayOperateButton(); |
| | | } |
| | | |
| | | [Serializable] |
| | | public class OperateButton |
| | | { |
| | | [SerializeField] RectTransform m_Container; |
| | | [SerializeField] Button m_Button; |
| | | [SerializeField] Text m_Title; |
| | | |
| | | ItemOperateType operateType; |
| | | string guid; |
| | | |
| | | public void SetActive(bool active) |
| | | { |
| | | this.m_Container.gameObject.SetActive(active); |
| | | } |
| | | |
| | | public void Bind(ItemOperateType type, string guid) |
| | | { |
| | | operateType = type; |
| | | this.guid = guid; |
| | | switch (type) |
| | | { |
| | | case ItemOperateType.putAway: |
| | | this.m_Title.text = "上架"; |
| | | break; |
| | | case ItemOperateType.sell: |
| | | this.m_Title.text = "出售"; |
| | | break; |
| | | case ItemOperateType.makeUse: |
| | | this.m_Title.text = "使用"; |
| | | break; |
| | | case ItemOperateType.putOut: |
| | | this.m_Title.text = "取出"; |
| | | break; |
| | | case ItemOperateType.putIn: |
| | | this.m_Title.text = "放入"; |
| | | break; |
| | | default: |
| | | this.m_Title.text = ""; |
| | | break; |
| | | } |
| | | |
| | | m_Button.SetListener(() => |
| | | { |
| | | WindowCenter.Instance.Close<PetMountTipWin>(); |
| | | EquipTipUtility.Operate(operateType, this.guid); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | public enum ShowType |
| | |
| | | |
| | | public class TipBuyItemWidget : MonoBehaviour |
| | | { |
| | | [SerializeField] Text m_VipInfo; |
| | | [SerializeField] Text m_LimitInfo; |
| | | [SerializeField] Text m_Count; |
| | | [SerializeField] Button m_Reduce; |
| | | [SerializeField] Button m_Add; |
| | | [SerializeField] Button m_SetBuyCount; |
| | | |
| | | [SerializeField] Image m_MoneyIcon; |
| | | [SerializeField] Text m_Money; |
| | | |
| | | [SerializeField] NumKeyBoard m_KeyBoard; |
| | | |
| | | int goodId = 0; |
| | | |
| | | public void Display(int goodId) |
| | | { |
| | | this.goodId = goodId; |
| | | BuyItemController.Instance.SetGood(goodId); |
| | | var isVipLimit = BuyItemController.Instance.IsVipLimitGood(); |
| | | if (isVipLimit) |
| | | { |
| | | m_LimitInfo.gameObject.SetActive(true); |
| | | var limitCount = BuyItemController.Instance.GetBuyCountLimit(PlayerDatas.Instance.baseData.VIPLv); |
| | | var nextVipLevel = BuyItemController.Instance.GetNextCanbuyVipLevel(PlayerDatas.Instance.baseData.VIPLv); |
| | | if (nextVipLevel == 999) |
| | | { |
| | | m_LimitInfo.text = Language.Get("StoreWin109"); |
| | | } |
| | | else |
| | | { |
| | | var nextVipLimitCount = BuyItemController.Instance.GetBuyCountLimit(nextVipLevel); |
| | | m_LimitInfo.text = Language.Get("StoreWin108", limitCount, nextVipLevel, nextVipLimitCount); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var limitCount = BuyItemController.Instance.GetBuyCountLimit(PlayerDatas.Instance.baseData.VIPLv); |
| | | if (limitCount != -1 && limitCount <= 0) |
| | | { |
| | | m_LimitInfo.gameObject.SetActive(true); |
| | | m_LimitInfo.text = Language.Get("StoreWin109"); |
| | | } |
| | | else |
| | | { |
| | | m_LimitInfo.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | var config = StoreConfig.Get(goodId); |
| | | m_MoneyIcon.SetIconWithMoneyType(config.MoneyType); |
| | | m_MoneyIcon.SetNativeSize(); |
| | | m_KeyBoard.gameObject.SetActive(false); |
| | | |
| | | DisplayDynamicInfo(true); |
| | | } |
| | | |
| | | private void LateUpdate() |
| | | { |
| | | DisplayDynamicInfo(false); |
| | | } |
| | | |
| | | private void DisplayDynamicInfo(bool force) |
| | | { |
| | | if (force || BuyItemController.Instance.wannaBuyCount.dirty) |
| | | { |
| | | DisplayCountAndPrice(BuyItemController.Instance.wannaBuyCount.Fetch()); |
| | | } |
| | | } |
| | | |
| | | private void DisplayCountAndPrice(int count) |
| | | { |
| | | m_Count.text = count.ToString(); |
| | | var limitCount = BuyItemController.Instance.GetBuyCountLimit(PlayerDatas.Instance.baseData.VIPLv); |
| | | m_Count.color = UIHelper.GetUIColor(limitCount != -1 && limitCount <= 0 ? TextColType.Red : TextColType.Green); |
| | | |
| | | var config = StoreConfig.Get(this.goodId); |
| | | var moneyOwn = UIHelper.GetMoneyCnt(config.MoneyType); |
| | | var totalPrice = BuyItemController.Instance.GetTotalPrice(count); |
| | | m_Money.text = totalPrice.ToString(); |
| | | m_Money.color = UIHelper.GetUIColor((ulong)totalPrice > moneyOwn ? TextColType.Red : TextColType.Green); |
| | | } |
| | | |
| | | private void AddBuyCount() |
| | | { |
| | | BuyItemController.Instance.SetBuyCount(BuyItemController.Instance.wannaBuyCount.value + 1); |
| | | } |
| | | |
| | | private void ReduceBuyCount() |
| | | { |
| | | BuyItemController.Instance.SetBuyCount(BuyItemController.Instance.wannaBuyCount.value - 1); |
| | | } |
| | | |
| | | private void SetBuyCount(bool value) |
| | | { |
| | | m_KeyBoard.gameObject.SetActive(false); |
| | | if (value) |
| | | { |
| | | BuyItemController.Instance.SetBuyCount(int.Parse(m_KeyBoard.Value)); |
| | | } |
| | | } |
| | | |
| | | private void Start() |
| | | { |
| | | m_Add.SetListener(AddBuyCount); |
| | | m_Reduce.SetListener(ReduceBuyCount); |
| | | m_SetBuyCount.SetListener(() => { m_KeyBoard.gameObject.SetActive(true); }); |
| | | m_KeyBoard.onConfirm.AddListener(SetBuyCount); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | var myMoney = UIHelper.GetMoneyCnt(1); |
| | | m_Condition.text = Language.Get("OpenBoxCostMoney", baseInfo.moneyLimit); |
| | | m_Condition.color = UIHelper.GetUIColor(myMoney <(ulong) baseInfo.moneyLimit ? TextColType.Red : TextColType.Green); |
| | | m_Condition.color = UIHelper.GetUIColor(myMoney < (ulong)baseInfo.moneyLimit ? TextColType.Red : TextColType.Green); |
| | | } |
| | | else if (baseInfo.realmLimit > 0) |
| | | { |
| | |
| | | m_Condition.color = UIHelper.GetUIColor(playerLevel < itemConfig.UseLV ? TextColType.Red : TextColType.Green); |
| | | } |
| | | |
| | | if (baseInfo.isAuction) |
| | | if (baseInfo.isPreview) |
| | | { |
| | | m_SurplusTimeContainer.gameObject.SetActive(true); |
| | | if (baseInfo.auctionSurplusTime > 0) |
| | | { |
| | | m_SurplusTime.text = TimeUtility.SecondsToHMSCHSRetain(baseInfo.auctionSurplusTime); |
| | | } |
| | | else |
| | | { |
| | | m_SurplusTime.text = "已过期"; |
| | | } |
| | | } |
| | | else if (itemConfig.ExpireTime > 0) |
| | | { |
| | | m_SurplusTimeContainer.gameObject.SetActive(true); |
| | | if (baseInfo.overdueSurplusTime > 0) |
| | | { |
| | | m_SurplusTime.text = TimeUtility.SecondsToConsumeRebate(baseInfo.overdueSurplusTime); |
| | | } |
| | | else |
| | | { |
| | | m_SurplusTime.text = "已过期"; |
| | | } |
| | | m_SurplusTimeContainer.gameObject.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | m_SurplusTimeContainer.gameObject.SetActive(false); |
| | | if (baseInfo.isAuction) |
| | | { |
| | | m_SurplusTimeContainer.gameObject.SetActive(true); |
| | | if (baseInfo.auctionSurplusTime > 0) |
| | | { |
| | | m_SurplusTime.text = TimeUtility.SecondsToHMSCHSRetain(baseInfo.auctionSurplusTime); |
| | | } |
| | | else |
| | | { |
| | | m_SurplusTime.text = "已过期"; |
| | | } |
| | | } |
| | | else if (itemConfig.ExpireTime > 0) |
| | | { |
| | | m_SurplusTimeContainer.gameObject.SetActive(true); |
| | | if (baseInfo.overdueSurplusTime > 0) |
| | | { |
| | | m_SurplusTime.text = TimeUtility.SecondsToConsumeRebate(baseInfo.overdueSurplusTime); |
| | | } |
| | | else |
| | | { |
| | | m_SurplusTime.text = "已过期"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | m_SurplusTimeContainer.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | [SerializeField] Button m_Button; |
| | | [SerializeField] Text m_Title; |
| | | |
| | | string windowName; |
| | | ItemOperateType operateType; |
| | | string guid; |
| | | |
| | |
| | | this.gameObject.SetActive(active); |
| | | } |
| | | |
| | | public void Bind(ItemOperateType type, string guid) |
| | | public void Bind(string windowName, ItemOperateType type, string guid) |
| | | { |
| | | operateType = type; |
| | | this.windowName = windowName; |
| | | this.operateType = type; |
| | | this.guid = guid; |
| | | switch (type) |
| | | { |
| | |
| | | case ItemOperateType.makeUse: |
| | | this.m_Title.text = "使用"; |
| | | break; |
| | | case ItemOperateType.split: |
| | | this.m_Title.text = "拆分"; |
| | | break; |
| | | case ItemOperateType.inlay: |
| | | this.m_Title.text = "镶嵌"; |
| | | break; |
| | | case ItemOperateType.putOut: |
| | | this.m_Title.text = "取出"; |
| | | break; |
| | | case ItemOperateType.putIn: |
| | | this.m_Title.text = "放入"; |
| | | break; |
| | | case ItemOperateType.compose: |
| | | this.m_Title.text = "合成"; |
| | | break; |
| | | case ItemOperateType.buy: |
| | | this.m_Title.text = "购买"; |
| | | break; |
| | | case ItemOperateType.putOn: |
| | | this.m_Title.text = "穿上"; |
| | | break; |
| | | case ItemOperateType.putOff: |
| | | this.m_Title.text = "脱下"; |
| | | break; |
| | | case ItemOperateType.strength: |
| | | this.m_Title.text = "强化"; |
| | | break; |
| | | case ItemOperateType.star: |
| | | this.m_Title.text = "升星"; |
| | | break; |
| | | case ItemOperateType.train: |
| | | this.m_Title.text = "洗炼"; |
| | | break; |
| | | default: |
| | | this.m_Title.text = ""; |
| | | break; |
| | |
| | | |
| | | m_Button.SetListener(() => |
| | | { |
| | | WindowCenter.Instance.Close<EquipTipWin>(); |
| | | EquipTipUtility.Operate(operateType, this.guid); |
| | | WindowCenter.Instance.Close(windowName); |
| | | if (this.operateType==ItemOperateType.buy) |
| | | { |
| | | EquipTipUtility.GoodOperate(operateType, BuyItemController.Instance.goodId, BuyItemController.Instance.wannaBuyCount.value); |
| | | } |
| | | else |
| | | { |
| | | EquipTipUtility.Operate(operateType, this.guid); |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | [SerializeField] TipLegendPropertyWidget m_LegendPropertyWidget; |
| | | [SerializeField] TipWingRefineMaterialsWidget m_RefineMaterialsWidget; |
| | | [SerializeField] TipItemDescriptionWidget m_DescriptionWidget; |
| | | [SerializeField] TipBuyItemWidget m_BuyItemWidget; |
| | | [SerializeField] TipGetWayEntranceWidget m_GetWayEntranceWidget; |
| | | [SerializeField] TipGetWaysWidget m_GetWaysWidget; |
| | | [SerializeField] TipJobAndPlaceWidget m_JobAndPlaceWidget; |
| | | [SerializeField] OperateButton[] m_OperateButtons; |
| | | [SerializeField] TipOperateButton[] m_OperateButtons; |
| | | [SerializeField] Button m_Close; |
| | | |
| | | #region Built-in |
| | |
| | | DisplayLegendProperty(); |
| | | DisplayRefineMaterials(); |
| | | DisplayItemDescription(); |
| | | DisplayBuyItem(); |
| | | DisplayJobAndPlace(); |
| | | DisplayGetWays(); |
| | | DisplayOperateButton(); |
| | |
| | | { |
| | | var itemId = EquipTipUtility.mainTipData.baseInfo.itemId; |
| | | m_DescriptionWidget.Display(itemId); |
| | | } |
| | | |
| | | private void DisplayBuyItem() |
| | | { |
| | | m_BuyItemWidget.gameObject.SetActive(EquipTipUtility.mainTipData.goodId > 0); |
| | | if (EquipTipUtility.mainTipData.goodId > 0) |
| | | { |
| | | m_BuyItemWidget.Display(EquipTipUtility.mainTipData.goodId); |
| | | } |
| | | } |
| | | |
| | | private void DisplayGetWays() |
| | |
| | | if (i < operates.Count) |
| | | { |
| | | button.SetActive(true); |
| | | button.Bind(operates[i], guid); |
| | | button.Bind("WingTipWin", operates[i], guid); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | [Serializable] |
| | | public class OperateButton |
| | | { |
| | | [SerializeField] RectTransform m_Container; |
| | | [SerializeField] Button m_Button; |
| | | [SerializeField] Text m_Title; |
| | | |
| | | ItemOperateType operateType; |
| | | string guid; |
| | | |
| | | public void SetActive(bool active) |
| | | { |
| | | this.m_Container.gameObject.SetActive(active); |
| | | } |
| | | |
| | | public void Bind(ItemOperateType type, string guid) |
| | | { |
| | | operateType = type; |
| | | this.guid = guid; |
| | | switch (type) |
| | | { |
| | | case ItemOperateType.putOn: |
| | | this.m_Title.text = "穿上"; |
| | | break; |
| | | case ItemOperateType.putOff: |
| | | this.m_Title.text = "脱下"; |
| | | break; |
| | | case ItemOperateType.sell: |
| | | this.m_Title.text = "出售"; |
| | | break; |
| | | case ItemOperateType.putOut: |
| | | this.m_Title.text = "取出"; |
| | | break; |
| | | case ItemOperateType.putIn: |
| | | this.m_Title.text = "放入"; |
| | | break; |
| | | default: |
| | | this.m_Title.text = ""; |
| | | break; |
| | | } |
| | | |
| | | m_Button.SetListener(() => |
| | | { |
| | | WindowCenter.Instance.Close<WingTipWin>(); |
| | | EquipTipUtility.Operate(operateType, this.guid); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | case ItemWinType.boxWin:
|
| | | if (curAttrData.isPreview)
|
| | | {
|
| | | EquipTipUtility.Show(curAttrData.itemId, TipType.Normal);
|
| | | EquipTipUtility.Show(curAttrData.itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | {
|
| | | if (curAttrData.isPreview)
|
| | | {
|
| | | EquipTipUtility.Show(curAttrData.itemId, TipType.Normal);
|
| | | EquipTipUtility.Show(curAttrData.itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | case ItemWinType.petMatWin:
|
| | | if (curAttrData.isPreview)
|
| | | {
|
| | | EquipTipUtility.Show(curAttrData.itemId, TipType.Normal);
|
| | | EquipTipUtility.Show(curAttrData.itemId);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | var runeModel = ModelCenter.Instance.GetModel<RuneModel>();
|
| | | var propertyValue = runeModel.GetRunePropertyDescription(runeId, 1);
|
| | |
|
| | | EquipTipUtility.Show(runeId,TipType.Normal);
|
| | | EquipTipUtility.Show(runeId);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | shopItemCell.coinsIcon.SetIconWithMoneyType(shopInfo.MoneyType);
|
| | | ulong shopCost = (ulong)(shopInfo.MoneyNumber);
|
| | | shopItemCell.coinNumText.text = UIHelper.ReplaceLargeNum(shopCost);
|
| | | BuyItemPopModel buyItem = BuyItemPopModel.Instance;
|
| | | BuyItemController buyItem = BuyItemController.Instance;
|
| | | int curVipIndex = -1;
|
| | | int nextVipIndex = -1;
|
| | | bool isVipBuy = buyItem.CheckIsVipBuy(shopInfo, out curVipIndex, out nextVipIndex);
|
| | |
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using System.Text;
|
| | |
|
| | | using UnityEngine;
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public class BuyItemPopModel : Singleton<BuyItemPopModel>
|
| | | |
| | | public class BuyItemController : Singleton<BuyItemController>
|
| | | {
|
| | | public StoreConfig storeConfig { get; private set; }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | public Dictionary<int, int> vipBuyCntDict = new Dictionary<int, int>();
|
| | | public bool CheckIsVipBuy(StoreConfig model,out int curVipIndex,out int nextVipIndex)
|
| | | public bool CheckIsVipBuy(StoreConfig model, out int curVipIndex, out int nextVipIndex)
|
| | | {
|
| | | vipBuyCntDict.Clear();
|
| | | curVipIndex = -1;
|
| | |
| | | isVipBuy = true;
|
| | | }
|
| | |
|
| | | if(isVipBuy)
|
| | | if (isVipBuy)
|
| | | {
|
| | | for (int i = model.VIPLV.Length-1; i > -1; i--)
|
| | | for (int i = model.VIPLV.Length - 1; i > -1; i--)
|
| | | {
|
| | | vipBuyCntDict.Add(model.VIPLV[i], model.PurchaseNumber[i]);
|
| | | }
|
| | |
| | | {
|
| | | nextVipIndex = i;
|
| | | }
|
| | | else if(model.VIPLV[i] <= playerVip)
|
| | | else if (model.VIPLV[i] <= playerVip)
|
| | | {
|
| | | curVipIndex = i;
|
| | | break;
|
| | |
| | | return isVipBuy;
|
| | | }
|
| | |
|
| | | public bool CheckIsLimitBuyCnt(StoreConfig model,out int canBuyCnt,out int addBuyCnt)
|
| | | public bool CheckIsLimitBuyCnt(StoreConfig model, out int canBuyCnt, out int addBuyCnt)
|
| | | {
|
| | | canBuyCnt = 0;
|
| | | addBuyCnt = 0;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public int GetCurBuyCnt(int buyCnt,int remainBuyCnt,out bool IsReachUpper)
|
| | | public int GetCurBuyCnt(int buyCnt, int remainBuyCnt, out bool IsReachUpper)
|
| | | {
|
| | | int count = 0;
|
| | | IsReachUpper = false;
|
| | | if(remainBuyCnt == 0)
|
| | | if (remainBuyCnt == 0)
|
| | | {
|
| | | IsReachUpper = true;
|
| | | count = 0;
|
| | | }
|
| | | else
|
| | | {
|
| | | if(buyCnt <= remainBuyCnt)
|
| | | if (buyCnt <= remainBuyCnt)
|
| | | {
|
| | | count = buyCnt;
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if(count < 0)
|
| | | if (count < 0)
|
| | | {
|
| | | count = 0;
|
| | | }
|
| | | return count;
|
| | | }
|
| | |
|
| | | public int GetRemainBuyCnt(int canBuyCnt,BuyShopItemLimit shopItemLimit,bool isVipBuy)
|
| | | public int GetRemainBuyCnt(int canBuyCnt, BuyShopItemLimit shopItemLimit, bool isVipBuy)
|
| | | {
|
| | | int haveBuyCnt = 0;
|
| | | if (shopItemLimit != null)
|
| | |
| | | return 0;
|
| | | }
|
| | | }
|
| | | public int GetBuyPrice(StoreConfig model,int buyCnt)
|
| | |
|
| | | public int GetBuyPrice(StoreConfig model, int buyCnt)
|
| | | {
|
| | | if (model == null) return 0;
|
| | |
|
| | | int buyItemPrice = model.MoneyNumber * buyCnt;
|
| | | return buyItemPrice;
|
| | | }
|
| | |
|
| | |
|
| | | public int goodId { get; private set; }
|
| | | public readonly LogicInt wannaBuyCount = new LogicInt();
|
| | |
|
| | | StoreModel model { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
|
| | | BuyShopItemLimit goodLimit;
|
| | |
|
| | | public void SetGood(int goodId)
|
| | | {
|
| | | this.goodId = goodId;
|
| | | wannaBuyCount.value = 1;
|
| | | goodLimit = model.GetBuyShopLimit((uint)goodId);
|
| | | }
|
| | |
|
| | | public void SetBuyCount(int count)
|
| | | {
|
| | | var countLimit = GetBuyCountLimit(count);
|
| | | if (countLimit == -1)
|
| | | {
|
| | | wannaBuyCount.value = Mathf.Clamp(count, 1, 999);
|
| | | }
|
| | | else
|
| | | {
|
| | | wannaBuyCount.value = Mathf.Clamp(count, 1, countLimit);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsVipLimitGood()
|
| | | {
|
| | | var config = StoreConfig.Get(goodId);
|
| | | return config != null && config.VIPLV.Length > 1 && config.VIPLV[0] > 0;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 返回值为-1,表示没有vip限制,返回值为999表示已经没有下一个vip限制
|
| | | /// </summary>
|
| | | /// <param name="goodId"></param>
|
| | | /// <param name="vipLevel"></param>
|
| | | /// <returns></returns>
|
| | | public int GetNextCanbuyVipLevel(int vipLevel)
|
| | | {
|
| | | if (!IsVipLimitGood())
|
| | | {
|
| | | return -1;
|
| | | }
|
| | |
|
| | | var config = StoreConfig.Get(goodId);
|
| | | var nextLevel = 999;
|
| | | for (int i = 0; i < config.VIPLV.Length; i++)
|
| | | {
|
| | | if (config.VIPLV[i] > vipLevel)
|
| | | {
|
| | | nextLevel = config.VIPLV[i];
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | return nextLevel;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 返回值如果是-1,表示无限制
|
| | | /// </summary>
|
| | | /// <param name="goodId"></param>
|
| | | /// <returns></returns>
|
| | | public int GetBuyCountLimit(int vipLevel)
|
| | | {
|
| | | return GetBuyCountLimit(this.goodId, vipLevel);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 返回值如果是-1,表示无限制
|
| | | /// </summary>
|
| | | /// <param name="goodId"></param>
|
| | | /// <returns></returns>
|
| | | public int GetBuyCountLimit(int goodId, int vipLevel)
|
| | | {
|
| | | var config = StoreConfig.Get(goodId);
|
| | | if (config.PurchaseNumber.Length == 0 || config.PurchaseNumber[0] == 0)
|
| | | {
|
| | | return -1;
|
| | | }
|
| | |
|
| | | var isVipLimitGood = config != null && config.VIPLV.Length > 1 && config.VIPLV[0] > 0;
|
| | | var canBuy = 0;
|
| | | if (isVipLimitGood)
|
| | | {
|
| | | var index = -1;
|
| | | for (var i = config.VIPLV.Length - 1; i >= 0; i--)
|
| | | {
|
| | | if (config.VIPLV[i] <= vipLevel)
|
| | | {
|
| | | index = i;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (index != -1)
|
| | | {
|
| | | canBuy = config.PurchaseNumber[index];
|
| | | }
|
| | | else
|
| | | {
|
| | | canBuy = 0;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | canBuy = config.PurchaseNumber[0];
|
| | | }
|
| | |
|
| | | var haveBuy = goodLimit != null ? goodLimit.BuyCnt : 0;
|
| | | return canBuy - haveBuy;
|
| | | }
|
| | |
|
| | | public int GetTotalPrice(int count)
|
| | | {
|
| | | var config = StoreConfig.Get(goodId);
|
| | | return config.MoneyNumber * count;
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
| | | get { return _storeModel ?? (_storeModel = ModelCenter.Instance.GetModel<StoreModel>()); }
|
| | | }
|
| | |
|
| | | BuyItemPopModel buyItem;
|
| | | BuyItemController buyItem;
|
| | | BuyShopItemLimit shopItemLimit;
|
| | | int canBuyCnt = 0;
|
| | | int buyCnt = 0;
|
| | |
| | | }
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | buyItem = BuyItemPopModel.Instance;
|
| | | buyItem = BuyItemController.Instance;
|
| | | shopItemLimit = m_storeModel.GetBuyShopLimit((uint)buyItem.storeConfig.ID);
|
| | | tipAlpha.alpha = 0;
|
| | | bottomPart.SetActive(false);
|
| | |
| | | StoreModel m_storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
|
| | |
|
| | | ItemAttrData itemAttrData;
|
| | | BuyItemPopModel buyItem;
|
| | | BuyItemController buyItem;
|
| | | BuyShopItemLimit shopItemLimit;
|
| | | int canBuyCnt = 0;
|
| | | int buyCnt = 0;
|
| | |
| | | public void InitModel(ItemAttrData attrData)
|
| | | {
|
| | | itemAttrData = attrData;
|
| | | buyItem = BuyItemPopModel.Instance;
|
| | | buyItem = BuyItemController.Instance;
|
| | | shopItemLimit = m_storeModel.GetBuyShopLimit((uint)buyItem.storeConfig.ID);
|
| | | InitUI();
|
| | | closeBtn.AddListener(OnClickCloseBtn);
|
| | |
| | | ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
|
| | | StoreModel m_storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
|
| | |
|
| | | BuyItemPopModel buyItem;
|
| | | BuyItemController buyItem;
|
| | | BuyShopItemLimit shopItemLimit;
|
| | | int canBuyCnt = 0;
|
| | | int buyCnt = 0;
|
| | |
| | | }
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | buyItem = BuyItemPopModel.Instance;
|
| | | buyItem = BuyItemController.Instance;
|
| | | shopItemLimit = m_storeModel.GetBuyShopLimit((uint)buyItem.storeConfig.ID);
|
| | | tipAlpha.alpha = 0;
|
| | | bottomPart.SetActive(false);
|
| | |
| | | PetModel petmodel { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
|
| | | MountModel mountModel { get { return ModelCenter.Instance.GetModel<MountModel>(); } }
|
| | |
|
| | | BuyItemPopModel buyItem;
|
| | | BuyItemController buyItem;
|
| | | BuyShopItemLimit shopItemLimit;
|
| | | int canBuyCnt = 0;
|
| | | int buyCnt = 0;
|
| | |
| | | }
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | buyItem = BuyItemPopModel.Instance;
|
| | | buyItem = BuyItemController.Instance;
|
| | | shopItemLimit = m_storeModel.GetBuyShopLimit((uint)buyItem.storeConfig.ID);
|
| | | tipAlpha.alpha = 0;
|
| | | topPart.SetActive(false);
|
| | |
| | | }
|
| | |
|
| | | ItemAttrData itemAttrData;
|
| | | BuyItemPopModel buyItem;
|
| | | BuyItemController buyItem;
|
| | | BuyShopItemLimit shopItemLimit;
|
| | | int canBuyCnt = 0;
|
| | | int buyCnt = 0;
|
| | |
| | | {
|
| | | curAttrTypeNum = 0;
|
| | | itemAttrData = attrData;
|
| | | buyItem = BuyItemPopModel.Instance;
|
| | | buyItem = BuyItemController.Instance;
|
| | | shopItemLimit = m_storeModel.GetBuyShopLimit((uint)buyItem.storeConfig.ID);
|
| | | InitUI();
|
| | | closeBtn.AddListener(OnClickCloseBtn);
|
| | |
| | | #region 点击商店物品逻辑
|
| | | public void OnClickShopCell(StoreConfig shopInfo)
|
| | | {
|
| | | BuyItemPopModel.Instance.SetModel(shopInfo.ID);
|
| | | int itemId = GetReplaceId(shopInfo.ID, shopInfo.ItemID);
|
| | | ItemAttrData attrData = new ItemAttrData(itemId, true, (ulong)shopInfo.ItemCnt, -1, true, PackType.Deleted
|
| | | , "", null, ItemTipChildType.Buy);
|
| | | itemTipsModel.SetItemTipsModel(attrData, false);
|
| | | attrData.SetTipsFuncBtn(ItemOperateType.buy, (ItemOperateType type, string id) => { OnClickBuyBtn(ItemOperateType.buy, shopInfo.ID); });
|
| | | itemTipsModel.ShowTip();
|
| | | EquipTipUtility.ShowGood(shopInfo.ID ,itemId);
|
| | | }
|
| | |
|
| | | public int BuyCnt { get; private set; }
|
| | | public void SetBuyCnt(int buyCnt)
|
| | | {
|
| | | BuyCnt = buyCnt;
|
| | | }
|
| | | private void OnClickBuyBtn(ItemOperateType type, int shopId)
|
| | | {
|
| | | BuyShopItemLimit shopItemLimit = GetBuyShopLimit((uint)shopId);
|
| | | StoreConfig storeConfig = StoreConfig.Get(shopId);
|
| | | int curVipIndex = -1;
|
| | | int nextVipIndex = -1;
|
| | | bool isVipBuy = TryGetVipBuy(storeConfig, out curVipIndex, out nextVipIndex);
|
| | | if (shopItemLimit != null)
|
| | | {
|
| | | int remainNum = 0;
|
| | | if (isVipBuy)
|
| | | {
|
| | | remainNum = storeConfig.PurchaseNumber[curVipIndex] - shopItemLimit.BuyCnt;
|
| | | }
|
| | | else
|
| | | {
|
| | | remainNum = storeConfig.PurchaseNumber[0] - shopItemLimit.BuyCnt;
|
| | | }
|
| | | if (remainNum < 1)
|
| | | {
|
| | | ServerTipDetails.DisplayNormalTip(Language.Get("StoreWin109"));
|
| | | return;
|
| | | }
|
| | |
|
| | | }
|
| | | SendBuyShopItem(storeConfig, BuyCnt);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | shopItemCell.coinsIcon.SetIconWithMoneyType(shopInfo.MoneyType);
|
| | | ulong shopCost = (ulong)(shopInfo.MoneyNumber);
|
| | | shopItemCell.coinNumText.text = UIHelper.ReplaceLargeNum(shopCost);
|
| | | BuyItemPopModel buyItem = BuyItemPopModel.Instance;
|
| | | BuyItemController buyItem = BuyItemController.Instance;
|
| | | int curVipIndex = -1;
|
| | | int nextVipIndex = -1;
|
| | | bool isVipBuy = buyItem.CheckIsVipBuy(shopInfo, out curVipIndex, out nextVipIndex);
|
| | |
| | | shopItemCell.coinsIcon.SetIconWithMoneyType(shopInfo.MoneyType);
|
| | | ulong shopCost = (ulong)(shopInfo.MoneyNumber);
|
| | | shopItemCell.coinNumText.text = UIHelper.ReplaceLargeNum(shopCost);
|
| | | BuyItemPopModel buyItem = BuyItemPopModel.Instance;
|
| | | BuyItemController buyItem = BuyItemController.Instance;
|
| | | int curVipIndex = -1;
|
| | | int nextVipIndex = -1;
|
| | | bool isVipBuy = buyItem.CheckIsVipBuy(shopInfo, out curVipIndex, out nextVipIndex);
|
| | |
| | | |
| | | public class Clock |
| | | { |
| | | public bool stopped { get; set; } |
| | | DateTime alarmTime; |
| | | UnityAction alarmCallBack; |
| | | |
| | |
| | | { |
| | | if (clocks.Contains(clock)) |
| | | { |
| | | clocks.Remove(clock); |
| | | clock.stopped = true; |
| | | } |
| | | } |
| | | |
| | |
| | | for (var i = clocks.Count - 1; i >= 0; i--) |
| | | { |
| | | var clock = clocks[i]; |
| | | if (clock.stopped) |
| | | { |
| | | clocks.RemoveAt(i); |
| | | continue; |
| | | } |
| | | |
| | | if (clock.CanAlarm()) |
| | | { |
| | | try |
| | | { |
| | | clock.Execute(); |
| | | clocks.RemoveAt(i); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Debug.LogException(e); |
| | | } |
| | | finally |
| | | { |
| | | clocks.RemoveAt(i); |
| | | } |
| | | } |
| | | } |