public static CUseable CreateUseable(COM_ITEM_TYPE useableType, uint baseID, int bCount = 0) { CUseable result = null; if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) { result = new CItem(0uL, baseID, bCount, 0); } else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMEQUIP) { result = new CEquip(0uL, baseID, bCount, 0); } else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HERO) { result = new CHeroItem(0uL, baseID, bCount, 0); } else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL) { result = new CSymbolItem(0uL, baseID, bCount, 0); } else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN) { result = new CHeroSkin(0uL, baseID, bCount, 0); } else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HEADIMG) { result = new CHeadImg(0uL, baseID, 0); } return(result); }
public static CUseable CreateUseable(COM_ITEM_TYPE useableType, ulong objID, uint baseID, int bCount = 0, int addTime = 0) { CUseable useable = null; if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) { return(new CItem(objID, baseID, bCount, addTime)); } if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMEQUIP) { return(new CEquip(objID, baseID, bCount, addTime)); } if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HERO) { return(new CHeroItem(objID, baseID, bCount, addTime)); } if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL) { return(new CSymbolItem(objID, baseID, bCount, addTime)); } if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN) { return(new CHeroSkin(objID, baseID, bCount, addTime)); } if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HEADIMG) { useable = new CHeadImg(objID, baseID, 0); } return(useable); }
public static CUseable CreateUseable(COM_ITEM_TYPE useableType, uint baseID, int bCount = 0) { CUseable result = null; if (useableType == 2) { result = new CItem(0uL, baseID, bCount, 0); } else if (useableType == 3) { result = new CEquip(0uL, baseID, bCount, 0); } else if (useableType == 4) { result = new CHeroItem(0uL, baseID, bCount, 0); } else if (useableType == 5) { result = new CSymbolItem(0uL, baseID, bCount, 0); } else if (useableType == 7) { result = new CHeroSkin(0uL, baseID, bCount, 0); } else if (useableType == 8) { result = new CHeadImg(0uL, baseID, 0); } return(result); }
public static void Show(COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onClose, CMallFactoryShopController.ShopProduct callContext = null, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null) { if (s_theDlg == null) { if (type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) { CItem item = new CItem(0L, id, 0, 0); if (item.m_itemData.bIsView != 0) { s_theDlg = new BuyPickDialog(true, type, id, coinType, discount, maxCount, onClose, callContext, onConfirmCommon, uieventPars); } else { s_theDlg = new BuyPickDialog(type, id, coinType, discount, maxCount, onClose, callContext, onConfirmCommon, uieventPars); } } else { s_theDlg = new BuyPickDialog(type, id, coinType, discount, maxCount, onClose, callContext, onConfirmCommon, uieventPars); } if (s_theDlg._root == null) { s_theDlg = null; } } }
public CMallMysteryProduct(ResAkaliShopGoods goodsCfg) { this.m_ID = goodsCfg.dwID; this.m_itemID = goodsCfg.dwGoodsID; this.m_ItemType = (COM_ITEM_TYPE)goodsCfg.bGoodsType; this.m_BoughtCnt = 0; this.m_Cfg = goodsCfg; }
public CMallMysteryProduct() { this.m_ID = 0; this.m_itemID = 0; this.m_ItemType = COM_ITEM_TYPE.COM_OBJTYPE_NULL; this.m_BoughtCnt = 0; this.m_Cfg = null; }
public static bool IsExpProp(COM_ITEM_TYPE itemType, uint itemId) { if (itemType != COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) { return(false); } ResPropInfo dataByKey = GameDataMgr.itemDatabin.GetDataByKey(itemId); return((dataByKey != null) && (dataByKey.EftParam[0] == 1f)); }
private void OnBuyItem(CUIEvent uiEvent) { enPayType tag = (enPayType)uiEvent.m_eventParams.tag; uint payValue = uiEvent.m_eventParams.commonUInt32Param1; string goodName = string.Empty; COM_ITEM_TYPE com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_NULL; uint uniSkinId = 0; long key = 0L; if (uiEvent.m_eventParams.heroSkinParam.skinId != 0) { com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN; uniSkinId = CSkinInfo.GetSkinCfgId(uiEvent.m_eventParams.heroSkinParam.heroId, uiEvent.m_eventParams.heroSkinParam.skinId); ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(uniSkinId); DebugHelper.Assert(heroSkin != null, string.Format("找不到皮肤{0}的配置信息", uniSkinId)); if (heroSkin == null) { return; } goodName = StringHelper.UTF8BytesToString(ref heroSkin.szSkinName); } else if (uiEvent.m_eventParams.heroId != 0) { com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_HERO; uniSkinId = uiEvent.m_eventParams.heroId; ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(uniSkinId); DebugHelper.Assert(dataByKey != null, string.Format("找不到英雄{0}的配置信息", uniSkinId)); if (dataByKey == null) { return; } goodName = StringHelper.UTF8BytesToString(ref dataByKey.szName); } else { DebugHelper.Assert(false, "神秘商店购买不支持该物品类型"); return; } key = GameDataMgr.GetDoubleKey((uint)com_item_type, uniSkinId); CMallMysteryProduct product = new CMallMysteryProduct(); if (!this.m_ProductDic.TryGetValue(key, out product)) { DebugHelper.Assert(false, string.Format("神秘商店找不到该物品{0}/{1}", Enum.GetName(typeof(COM_ITEM_TYPE), com_item_type), uniSkinId)); } else { CUIEvent uIEvent = Singleton <CUIEventManager> .GetInstance().GetUIEvent(); uIEvent.m_eventID = enUIEventID.Mall_Mystery_On_Confirm_Buy_Item; uIEvent.m_eventParams.tag = (int)product.ID; CMallSystem.TryToPay(enPayPurpose.Buy, goodName, tag, payValue, uIEvent.m_eventID, ref uIEvent.m_eventParams, enUIEventID.None, false, true); } }
public CMail(CustomMailType mailType, ref CSDT_ASKFORREQ_DETAIL pkg) { this.mailType = mailType; this.subType = (byte)mailType; this.mailIndex = pkg.iReqIndex; this.mailState = ((pkg.bIsRead > 0) ? COM_MAIL_STATE.COM_MAIL_HAVEREAD : COM_MAIL_STATE.COM_MAIL_UNREAD); this.autoDel = false; this.from = Utility.UTF8Convert(pkg.stReqInfo.szAcntName); this.sendTime = pkg.stReqInfo.dwReqTime; COM_ITEM_TYPE wItemType = (COM_ITEM_TYPE)pkg.stReqInfo.stReqItem.wItemType; uint dwItemID = pkg.stReqInfo.stReqItem.dwItemID; int dwItemCnt = (int)pkg.stReqInfo.stReqItem.dwItemCnt; CUseable cUseable = CUseableManager.CreateUseable(wItemType, dwItemID, dwItemCnt); if (cUseable.m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN) { this.subject = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSkinBuy_Ask_For_Mail_Title_Skin"), cUseable.m_name); } else { this.subject = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSkinBuy_Ask_For_Mail_Title_Hero"), cUseable.m_name); } if (pkg.stReqInfo.stMsgInfo.bMsgType == 1) { this.mailContent = StringHelper.UTF8BytesToString(ref pkg.stReqInfo.stMsgInfo.stMsgInfo.stMsgString.szContentStr); if (string.IsNullOrEmpty(this.mailContent)) { this.mailContent = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSKinBuy_Ask_For_Default_Msg"), cUseable.m_name); } } else { uint dwMsgID = pkg.stReqInfo.stMsgInfo.stMsgInfo.stMsgIDInfo.dwMsgID; ulong num = Convert.ToUInt64(dwMsgID); num <<= 32; int num2 = Convert.ToInt32(wItemType); long key = (long)(num + (ulong)((long)num2)); ResAskforTemplet dataByKey = GameDataMgr.askForTemplateDatabin.GetDataByKey(key); if (dataByKey == null) { this.mailContent = string.Format(Singleton <CTextManager> .GetInstance().GetText("HeroSKinBuy_Ask_For_Default_Msg"), cUseable.m_name); } else { this.mailContent = string.Format(dataByKey.szContent, cUseable.m_name); } } this.accessUseableGeted = 0; this.accessUseable.Clear(); this.accessUseable.Add(cUseable); }
public static CUseable CreateExpUseable(COM_ITEM_TYPE useableType, ulong objID, uint expDays, uint baseID, int bCount = 0, int addTime = 0) { CUseable result = null; if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HERO) { result = new CExpHeroItem(0uL, baseID, expDays, bCount, 0); } else if (useableType == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN) { result = new CExpHeroSkin(0uL, baseID, expDays, bCount, 0); } return(result); }
public CUseable GetUseableByBaseID(COM_ITEM_TYPE itemType, uint baseID) { if (this.m_useableList != null) { for (int i = 0; i < this.m_useableList.Count; i++) { CUseable useable2 = this.m_useableList[i]; if (((useable2 != null) && (useable2.m_baseID == baseID)) && (useable2.m_type == itemType)) { return(useable2); } } } return(null); }
public int GetUseableStackCount(COM_ITEM_TYPE itemType, uint baseID) { int num = 0; if (this.m_useableList != null) { for (int i = 0; i < this.m_useableList.get_Count(); i++) { CUseable cUseable = this.m_useableList.get_Item(i); if (cUseable != null && cUseable.m_type == itemType && cUseable.m_baseID == baseID) { num += cUseable.m_stackCount; } } } return(num); }
public int GetUseableStackCount(COM_ITEM_TYPE itemType, uint baseID) { int num = 0; if (this.m_useableList != null) { for (int i = 0; i < this.m_useableList.Count; i++) { CUseable useable = this.m_useableList[i]; if (((useable != null) && (useable.m_type == itemType)) && (useable.m_baseID == baseID)) { num += useable.m_stackCount; } } } return(num); }
public CUseable GetUseableByBaseID(COM_ITEM_TYPE itemType, uint baseID) { CUseable result = null; if (this.m_useableList != null) { for (int i = 0; i < this.m_useableList.get_Count(); i++) { CUseable cUseable = this.m_useableList.get_Item(i); if (cUseable != null && cUseable.m_baseID == baseID && cUseable.m_type == itemType) { result = cUseable; break; } } } return(result); }
public CUseable Add(COM_ITEM_TYPE useableType, ulong objID, uint baseID, int iCount, int addTime) { CUseable useableByObjID = null; if (((useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) || (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMEQUIP)) || (useableType == COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL)) { useableByObjID = this.GetUseableByObjID(objID); if (useableByObjID == null) { CUseable useable = CUseableManager.CreateUseable(useableType, objID, baseID, iCount, addTime); this.Add(useable); return(useable); } useableByObjID.m_stackCount += iCount; useableByObjID.ResetTime(); } return(useableByObjID); }
public CUseable Add(COM_ITEM_TYPE useableType, ulong objID, uint baseID, int iCount, int addTime) { CUseable cUseable = null; if (useableType == 2 || useableType == 3 || useableType == 5) { cUseable = this.GetUseableByObjID(objID); if (cUseable == null) { CUseable cUseable2 = CUseableManager.CreateUseable(useableType, objID, baseID, iCount, addTime); this.Add(cUseable2); cUseable = cUseable2; } else { cUseable.m_stackCount += iCount; cUseable.ResetTime(); } } return(cUseable); }
public BuyPickDialog(COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null) { CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm(s_Form_Path, false, true); if (null != script) { this._root = script.gameObject; this._usb = CUseableManager.CreateUseable(type, id, 0); this._bHeroSkinGift = false; this._bDynamicCorrectPrice = false; this._heroSkinGiftCost = 0; this._count = 1; this._maxCount = maxCount; if (this._maxCount == 0) { this._maxCount = 0x3e7; } this._onConfirm = onConfirm; this._callContext = callContext; this._onConfirmdCommon = onConfirmCommon; this._uieventPars = uieventPars; this._coinType = coinType; this._realDiscount = discount; if (this._usb != null) { this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count"); this._costText = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost"); this._descText = Utility.GetComponetInChild <Text>(this._root, "Panel/Desc/Image/Text"); if (this._descText != null) { this._descText.text = this._usb.m_description; } Utility.GetComponetInChild <Image>(this._root, "Panel/Slot/Icon").SetSprite(CUIUtility.GetSpritePrefeb(this._usb.GetIconPath(), false, false)); Utility.GetComponetInChild <Text>(this._root, "Panel/Name").text = this._usb.m_name; this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0); if (this._coinUsb != null) { Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false)); Utility.GetComponetInChild <Text>(this._root, "Panel/Price").text = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(this._usb.GetBuyPrice(coinType), this._realDiscount).ToString(); } Image componetInChild = Utility.GetComponetInChild <Image>(this._root, "Panel/Slot/imgExperienceMark"); if (componetInChild != null) { if ((this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) && CItem.IsHeroExperienceCard(this._usb.m_baseID)) { componetInChild.gameObject.CustomSetActive(true); componetInChild.SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.HeroExperienceCardMarkPath, false, false)); } else if ((this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) && CItem.IsSkinExperienceCard(this._usb.m_baseID)) { componetInChild.gameObject.CustomSetActive(true); componetInChild.SetSprite(CUIUtility.GetSpritePrefeb(CExperienceCardSystem.SkinExperienceCardMarkPath, false, false)); } else { componetInChild.gameObject.CustomSetActive(false); } } } Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel)); this.ValidateDynamic(); } }
public static stPayInfoSet GetPayInfoSetOfGood(COM_ITEM_TYPE itemType, uint itemID) { CMallMysteryShop instance = Singleton <CMallMysteryShop> .GetInstance(); stPayInfoSet set = new stPayInfoSet(2); long doubleKey = GameDataMgr.GetDoubleKey((uint)itemType, itemID); CMallMysteryProduct product = new CMallMysteryProduct(); if (!instance.m_ProductDic.TryGetValue(doubleKey, out product)) { return(set); } uint index = (instance.Discount / 10) - 1; stPayInfo info = new stPayInfo(); switch (product.ItemType) { case COM_ITEM_TYPE.COM_OBJTYPE_HERO: { ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(itemID); DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在"); if (dataByKey != null) { info.m_payType = CMallSystem.ResBuyTypeToPayType(product.Cfg.bMoneyType); switch (info.m_payType) { case enPayType.GoldCoin: info.m_oriValue = (uint)dataByKey.dwBuyCoin; goto Label_01A7; case enPayType.DianQuan: info.m_oriValue = (uint)dataByKey.dwBuyCoupons; goto Label_01A7; case enPayType.Diamond: case enPayType.DiamondAndDianQuan: info.m_oriValue = (uint)dataByKey.dwBuyDiamond; goto Label_01A7; } break; } return(set); } case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN: { ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(itemID); DebugHelper.Assert(heroSkin != null, "神秘商店配置的皮肤ID有错,皮肤表里不存在"); if (heroSkin != null) { info.m_payType = CMallSystem.ResBuyTypeToPayType(product.Cfg.bMoneyType); switch (info.m_payType) { case enPayType.DianQuan: info.m_oriValue = heroSkin.dwBuyCoupons; goto Label_01A7; case enPayType.Diamond: case enPayType.DiamondAndDianQuan: info.m_oriValue = heroSkin.dwBuyDiamond; goto Label_01A7; } break; } return(set); } } Label_01A7: if (info.m_oriValue == 0) { info.m_oriValue = (uint)product.Cfg.RouZheKou[product.Cfg.RouZheKou.Length - 1]; } if ((index < 0) || (index >= product.Cfg.RouZheKou.Length)) { info.m_payValue = info.m_oriValue; info.m_discountForDisplay = 0x2710; } else if (instance.IsRandomDiscount) { info.m_payValue = (uint)product.Cfg.RouZheKou[index]; info.m_discountForDisplay = instance.Discount * 100; } else { info.m_payValue = (uint)product.Cfg.iConfirmZheKou; info.m_discountForDisplay = instance.Discount * 100; } set.m_payInfos[set.m_payInfoCount] = info; set.m_payInfoCount++; return(set); }
public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null) { CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true); if (null != formScript) { this._root = formScript.gameObject; this._usb = CUseableManager.CreateUseable(type, id, 0); this._count = 1; this._bHeroSkinGift = false; this._bDynamicCorrectPrice = false; this._heroSkinGiftCost = 0; this._maxCount = maxCount; if (this._maxCount == 0) { this._maxCount = 0x3e7; } this._onConfirm = onConfirm; this._callContext = callContext; this._onConfirmdCommon = onConfirmCommon; this._uieventPars = uieventPars; this._coinType = coinType; this._realDiscount = discount; if (this._usb != null) { this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count"); this._costText = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost"); this._descText = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc"); CItem item = new CItem(0L, id, 0, 0); uint key = (uint)item.m_itemData.EftParam[0]; ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key); ListView <CUseable> view = new ListView <CUseable>(); for (int i = 0; i < dataByKey.astRewardDetail.Length; i++) { if (dataByKey.astRewardDetail[i].bItemType != 0) { CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID); if (useable != null) { view.Add(useable); } } } if (this._descText != null) { this._descText.text = item.m_description; } uint num3 = 0; int num4 = 0; if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) { CItem item2 = (CItem)this._usb; if (((item2 != null) && (item2.m_itemData != null)) && (item2.m_itemData.bType == 4)) { this._bDynamicCorrectPrice = item2.m_itemData.EftParam[3] > 0f; } } for (int j = 0; j < 10; j++) { GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject; if (j < view.Count) { gameObject.CustomSetActive(true); CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false); Transform transform = gameObject.transform.Find("HaveItemFlag"); transform.gameObject.CustomSetActive(false); if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO) { this._bHeroSkinGift = true; CHeroItem item3 = view[j] as CHeroItem; CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item3.m_heroData.dwCfgID)) { num3 += CHeroInfo.GetHeroCost(item3.m_heroData.dwCfgID, coinType); num4++; transform.gameObject.CustomSetActive(true); } } else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN) { this._bHeroSkinGift = true; CHeroSkin skin = view[j] as CHeroSkin; CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false)) { num3 += CSkinInfo.GetHeroSkinCost(skin.m_heroId, skin.m_skinId, coinType); num4++; transform.gameObject.CustomSetActive(true); } } } else { gameObject.CustomSetActive(false); } } this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0); if (this._coinUsb != null) { Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false)); } Text componetInChild = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText"); componetInChild.text = string.Empty; if (this._bHeroSkinGift && this._bDynamicCorrectPrice) { uint buyPrice = this._usb.GetBuyPrice(coinType); Button btn = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale"); if (num4 >= view.Count) { CUICommonSystem.SetButtonEnableWithShader(btn, false, true); componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip"); this._heroSkinGiftCost = 0; } else { CUICommonSystem.SetButtonEnableWithShader(btn, true, true); componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip"); uint num7 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num3, this._realDiscount); if ((buyPrice >= num3) && (num7 >= (buyPrice / 10))) { this._heroSkinGiftCost = num7; } else { this._heroSkinGiftCost = buyPrice / 10; } } if (this._callContext != null) { this._callContext.m_bChangeGiftPrice = true; this._callContext.m_newGiftPrice = this._heroSkinGiftCost; } } } Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel)); this.ValidateDynamic(); } }
public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, BuyPickDialog.OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, BuyPickDialog.OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null, bool bfromFactoyShop = false) { this.m_bShowBigIcon = (callContext != null && callContext.GetSpecialIconPath() != null); CUIFormScript cUIFormScript; if (this.m_bShowBigIcon) { cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Big_Icon_Form_Path, false, true); } else { cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Form_Path, false, true); } if (null != cUIFormScript) { this._root = cUIFormScript.gameObject; this._usb = CUseableManager.CreateUseable(type, id, 0); this._count = 1u; this._bHeroSkinGift = false; this._bDynamicCorrectPrice = false; this._heroSkinGiftCost = 0u; this._maxCount = maxCount; if (this._maxCount == 0u) { this._maxCount = 999u; } this._onConfirm = onConfirm; this._callContext = callContext; this._onConfirmdCommon = onConfirmCommon; this._uieventPars = uieventPars; this._coinType = coinType; this._realDiscount = discount; if (this._usb != null) { this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count"); this._costText = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost"); this._descText = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc"); CItem cItem = new CItem(0uL, id, 0, 0); uint key = (uint)cItem.m_itemData.EftParam[0]; ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key); ListView <CUseable> listView = new ListView <CUseable>(); for (int i = 0; i < dataByKey.astRewardDetail.Length; i++) { if (dataByKey.astRewardDetail[i].bItemType != 0) { CUseable cUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID); if (cUseable != null) { listView.Add(cUseable); } } } if (this._descText != null) { this._descText.set_text(string.IsNullOrEmpty(cItem.m_mallDescription) ? cItem.m_description : cItem.m_mallDescription); } uint num = 0u; int num2 = 0; if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP) { CItem cItem2 = (CItem)this._usb; if (cItem2 != null && cItem2.m_itemData != null && cItem2.m_itemData.bType == 4) { this._bDynamicCorrectPrice = (cItem2.m_itemData.EftParam[3] > 0f); } } CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(cUIFormScript.gameObject, "Panel/itemGroup"); componetInChild.SetElementAmount(listView.Count); for (int j = 0; j < listView.Count; j++) { CUIListElementScript elemenet = componetInChild.GetElemenet(j); this.UpdateElement(elemenet, listView[j], this.m_bShowBigIcon); if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO) { this._bHeroSkinGift = true; CHeroItem cHeroItem = listView[j] as CHeroItem; CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null && masterRoleInfo.IsOwnHero(cHeroItem.m_heroData.dwCfgID)) { num += CHeroInfo.GetHeroCost(cHeroItem.m_heroData.dwCfgID, coinType); num2++; } } else if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN) { this._bHeroSkinGift = true; CHeroSkin cHeroSkin = listView[j] as CHeroSkin; CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo2 != null && masterRoleInfo2.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false)) { num += CSkinInfo.GetHeroSkinCost(cHeroSkin.m_heroId, cHeroSkin.m_skinId, coinType); num2++; } } } this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0); if (this._coinUsb != null) { Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false), false); } Text componetInChild2 = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText"); componetInChild2.set_text(string.Empty); if (this._bHeroSkinGift && this._bDynamicCorrectPrice) { uint buyPrice = this._usb.GetBuyPrice(coinType); Button componetInChild3 = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale"); if (num2 >= listView.Count) { CUICommonSystem.SetButtonEnableWithShader(componetInChild3, false, true); componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip")); this._heroSkinGiftCost = 0u; } else { CUICommonSystem.SetButtonEnableWithShader(componetInChild3, true, true); componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip")); uint num3 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num, this._realDiscount); if (buyPrice >= num && num3 >= buyPrice / 10u) { this._heroSkinGiftCost = num3; } else { this._heroSkinGiftCost = buyPrice / 10u; } } if (this._callContext != null) { this._callContext.m_bChangeGiftPrice = true; this._callContext.m_newGiftPrice = this._heroSkinGiftCost; } } } Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_CloseForm, new CUIEventManager.OnUIEventHandler(this.OnCloseForm)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_ConfirmFactoryShopBuy, new CUIEventManager.OnUIEventHandler(this.OnConfirmFactoryShopBuy)); this.ValidateDynamic(); } }
public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, uint discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null) { CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true); if (null != formScript) { this._root = formScript.gameObject; this._usb = CUseableManager.CreateUseable(type, id, 0); this._count = 1; this._maxCount = maxCount; if (this._maxCount == 0) { this._maxCount = 0x3e7; } this._onConfirm = onConfirm; this._callContext = callContext; this._onConfirmdCommon = onConfirmCommon; this._uieventPars = uieventPars; this._coinType = coinType; this._discount = discount; if (this._usb != null) { this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count"); this._costText = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost"); this._descText = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc"); CItem item = new CItem(0L, id, 0, 0); uint key = (uint)item.m_itemData.EftParam[0]; ResRandomRewardStore dataByKey = GameDataMgr.randowmRewardDB.GetDataByKey(key); ListView <CUseable> view = new ListView <CUseable>(); for (int i = 0; i < dataByKey.astRewardDetail.Length; i++) { if (dataByKey.astRewardDetail[i].bItemType != 0) { CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID); if (useable != null) { view.Add(useable); } } } if (this._descText != null) { this._descText.text = item.m_description; } for (int j = 0; j < 10; j++) { GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject; if (j < view.Count) { gameObject.CustomSetActive(true); CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false); Transform transform = gameObject.transform.Find("HaveItemFlag"); transform.gameObject.CustomSetActive(false); if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO) { CHeroItem item2 = view[j] as CHeroItem; CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item2.m_heroData.dwCfgID)) { transform.gameObject.CustomSetActive(true); } } else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN) { CHeroSkin skin = view[j] as CHeroSkin; CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false)) { transform.gameObject.CustomSetActive(true); } } } else { gameObject.CustomSetActive(false); } } this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0); if (this._coinUsb != null) { Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false)); } } Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel)); this.ValidateDynamic(); } }
private void UpdateItem(CUIEvent uiEvent, COMDT_AKALISHOP_GOODS productInfo) { if (productInfo == null) { return; } CUIFormScript srcFormScript = uiEvent.m_srcFormScript; GameObject srcWidget = uiEvent.m_srcWidget; if (srcFormScript == null || srcWidget == null) { return; } CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "master roleInfo is null"); if (masterRoleInfo == null) { return; } GameObject gameObject = Utility.FindChild(srcWidget, "heroItem"); if (gameObject == null) { DebugHelper.Assert(gameObject != null, "hero item is null"); return; } GameObject gameObject2 = Utility.FindChild(srcWidget, "defualtItem"); if (gameObject2 != null) { gameObject2.CustomSetActive(false); } if (gameObject != null) { gameObject.CustomSetActive(true); } Text componetInChild = Utility.GetComponetInChild <Text>(gameObject, "heroDataPanel/heroNamePanel/heroNameText"); GameObject gameObject3 = Utility.FindChild(gameObject, "heroDataPanel/heroNamePanel/heroSkinText"); if (gameObject3 == null) { return; } Text component = gameObject3.GetComponent <Text>(); GameObject gameObject4 = Utility.FindChild(gameObject, "tag"); if (gameObject4 == null) { return; } GameObject gameObject5 = Utility.FindChild(gameObject, "profession"); if (gameObject5 == null) { return; } GameObject gameObject6 = Utility.FindChild(srcWidget, "imgExperienceMark"); if (gameObject6 == null) { return; } if (gameObject6) { gameObject6.CustomSetActive(true); } GameObject gameObject7 = Utility.FindChild(gameObject, "skinLabelImage"); if (gameObject7 == null) { return; } GameObject gameObject8 = Utility.FindChild(gameObject, "heroDataPanel/heroPricePanel"); if (gameObject8 == null) { return; } gameObject8.CustomSetActive(false); GameObject gameObject9 = Utility.FindChild(srcWidget, "ButtonGroup/BuyBtn"); if (gameObject9 == null) { return; } gameObject9.CustomSetActive(false); Text componetInChild2 = Utility.GetComponetInChild <Text>(gameObject9, "Text"); Button component2 = gameObject9.GetComponent <Button>(); if (component2 == null) { return; } CUIEventScript component3 = gameObject9.GetComponent <CUIEventScript>(); if (component3 == null) { return; } component3.enabled = false; component2.enabled = false; GameObject gameObject10 = Utility.FindChild(srcWidget, "ButtonGroup/LinkBtn"); if (gameObject10 == null) { return; } gameObject10.CustomSetActive(false); Text componetInChild3 = Utility.GetComponetInChild <Text>(gameObject10, "Text"); Button component4 = gameObject10.GetComponent <Button>(); if (component4 == null) { return; } CUIEventScript component5 = gameObject10.GetComponent <CUIEventScript>(); if (component5 == null) { return; } component5.enabled = false; component4.enabled = false; COM_ITEM_TYPE wItemType = (COM_ITEM_TYPE)productInfo.wItemType; uint dwItemID = productInfo.dwItemID; switch (wItemType) { case COM_ITEM_TYPE.COM_OBJTYPE_HERO: { ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(dwItemID); DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在"); if (dataByKey == null) { return; } ResHeroShop resHeroShop = null; GameDataMgr.heroShopInfoDict.TryGetValue(dataByKey.dwCfgID, out resHeroShop); CUICommonSystem.SetHeroItemImage(uiEvent.m_srcFormScript, gameObject, StringHelper.UTF8BytesToString(ref dataByKey.szImagePath), enHeroHeadType.enBust, false, true); gameObject5.CustomSetActive(false); gameObject7.CustomSetActive(false); gameObject3.CustomSetActive(false); if (componetInChild != null) { componetInChild.set_text(StringHelper.UTF8BytesToString(ref dataByKey.szName)); } if (masterRoleInfo.IsHaveHero(dataByKey.dwCfgID, false)) { gameObject9.CustomSetActive(true); componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Hero_State_Own")); gameObject4.CustomSetActive(false); gameObject6.CustomSetActive(false); } else { gameObject6.CustomSetActive(masterRoleInfo.IsValidExperienceHero(dataByKey.dwCfgID)); gameObject8.CustomSetActive(true); gameObject9.CustomSetActive(true); componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Buy")); component3.enabled = true; component2.enabled = true; this.UpdateItemPricePnl(srcFormScript, gameObject8.transform, gameObject4.transform, productInfo); component3.SetUIEvent(enUIEventType.Click, enUIEventID.Mall_Mystery_On_Open_Buy_Form, new stUIEventParams { tag = uiEvent.m_srcWidgetIndexInBelongedList }); } break; } case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN: { ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(dwItemID); DebugHelper.Assert(heroSkin != null, "神秘商店配置的皮肤ID有错,皮肤表里不存在"); if (heroSkin == null) { return; } ResHeroSkinShop resHeroSkinShop = null; GameDataMgr.skinShopInfoDict.TryGetValue(heroSkin.dwSkinID, out resHeroSkinShop); ResHeroCfgInfo dataByKey2 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID); DebugHelper.Assert(dataByKey2 != null, "神秘商店配置的皮肤ID有错,皮肤对应的英雄不存在"); if (dataByKey2 == null) { return; } CUICommonSystem.SetHeroItemImage(uiEvent.m_srcFormScript, gameObject.gameObject, heroSkin.szSkinPicID, enHeroHeadType.enBust, false, true); gameObject5.CustomSetActive(false); CUICommonSystem.SetHeroSkinLabelPic(uiEvent.m_srcFormScript, gameObject7, heroSkin.dwHeroID, heroSkin.dwSkinID); gameObject3.CustomSetActive(true); if (componetInChild != null) { componetInChild.set_text(StringHelper.UTF8BytesToString(ref dataByKey2.szName)); } if (component != null) { component.set_text(StringHelper.UTF8BytesToString(ref heroSkin.szSkinName)); } if (masterRoleInfo.IsHaveHeroSkin(heroSkin.dwHeroID, heroSkin.dwSkinID, false)) { gameObject9.CustomSetActive(true); componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Skin_State_Own")); gameObject4.CustomSetActive(false); gameObject6.CustomSetActive(false); } else { gameObject6.CustomSetActive(masterRoleInfo.IsValidExperienceSkin(heroSkin.dwHeroID, heroSkin.dwSkinID)); gameObject8.CustomSetActive(true); gameObject10.CustomSetActive(false); this.UpdateItemPricePnl(srcFormScript, gameObject8.transform, gameObject4.transform, productInfo); if (masterRoleInfo.IsCanBuySkinButNotHaveHero(heroSkin.dwHeroID, heroSkin.dwSkinID)) { gameObject9.CustomSetActive(true); component3.enabled = true; componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Skin_State_Buy_hero")); component2.enabled = true; stUIEventParams eventParams = default(stUIEventParams); eventParams.openHeroFormPar.heroId = heroSkin.dwHeroID; eventParams.openHeroFormPar.skinId = heroSkin.dwSkinID; eventParams.openHeroFormPar.openSrc = enHeroFormOpenSrc.SkinBuyClick; component3.SetUIEvent(enUIEventType.Click, enUIEventID.HeroInfo_OpenForm, eventParams); this.UpdateItemPricePnl(srcFormScript, gameObject8.transform, gameObject4.transform, productInfo); } else { gameObject10.CustomSetActive(false); gameObject9.CustomSetActive(true); componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Mall_Buy")); component3.enabled = true; component2.enabled = true; component3.SetUIEvent(enUIEventType.Click, enUIEventID.Mall_Mystery_On_Open_Buy_Form, new stUIEventParams { tag = uiEvent.m_srcWidgetIndexInBelongedList }); } } break; } } }