void updateEggCostInfo() { PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (pdm == null) { return; } for (int i = 0; i < EggModule.EGG_COUNT; i++) { EggType et = (EggType)(i + 1); int num = EggModule.getCostProcNum(et); ProceedsType pt = EggModule.getCostProcType(et); if (pt == ProceedsType.Invalid || num <= 0) { costLb[i].transform.parent.gameObject.SetActive(false); } else { if (pdm.GetProceeds(pt) < num) { costLb[i].text = StringHelper.StringWithColor(FontColor.Red, num.ToString()); } else { costLb[i].text = num.ToString(); } UIAtlasHelper.SetSpriteByMoneyType(costSp[i], pt, false); costLb[i].transform.parent.gameObject.SetActive(true); } } }
protected override void OnRespond(respond_egg_op respond, object userdata) { EggModule module = ModuleManager.Instance.FindModule <EggModule>(); if (module == null) { GameDebug.LogError("没有找到shopmodule"); return; } if (respond.result != (int)Message.ERROR_CODE.ERR_EGG_OK) { switch ((Message.ERROR_CODE)respond.result) { case ERROR_CODE.ERR_EGG_FAILED: break; //case ERROR_CODE.ERR_MALL_BUY_NO_TIMES: // break; //case ERROR_CODE.ERR_MALL_FAILED: // break; default: break; } return; } if (userdata is EggClickParam) { module.OpenEggSucess((EggType)(respond.eggid), respond.items); } }
public bool ResetEggTimeCounter(EggType et) { int idx = (int)et - 1; mEggData[idx].time_second = EggModule.getCountDownSeconds(et); return(true); }
void BuildItems() { BetterList <int> itemIds = EggModule.GetShowItemsItemID(); if (itemIds == null) { GameDebug.LogError("表格数据错误"); return; } //int count = 0; foreach (int itemid in itemIds) { ItemTableItem item = ItemManager.GetItemRes(itemid); if (item == null) { GameDebug.LogError("物品表中不存在物品ID:" + itemid); continue; } GameObject go = WindowManager.Instance.CloneGameObject(mEggShowItemPrefab); if (go == null) { GameDebug.LogError("创建gameobj失败"); continue; } go.name = item.id.ToString(); go.transform.parent = mItemGrid.transform; go.transform.localScale = Vector3.one; EggShowItemUI showui = new EggShowItemUI(go); //showui.SetImg(item.picname, true); showui.SetInfo(item.id); //UIAtlasHelper.SetSpriteImage(mItems[count], item.picname , true); //count++; //if (count > mItems.size) // break; } mItemGrid.repositionNow = true; mItemScrollBar.value = 0f; }
GameObject createItem(EggType et, role_egg_item_items item, GameObject parent) { GameObject go = WindowManager.Instance.CloneGameObject(mEggGoodsPrefab); if (go == null) { return(null); } go.SetActive(false); go.name = item.itemid.ToString(); go.transform.parent = parent.transform; go.transform.localScale = Vector3.one; go.transform.localPosition = ITEM_DROP_START_POS; go.SetActive(true); EggGoodsUI goodsItem = new EggGoodsUI(go); bool isShowAni = EggModule.GetItemIsInShowItems(item.itemid); goodsItem.SetData(item.itemid, item.itemnum, isShowAni); return(go); }