//void Awake() //{ //gameObject.SetActiveRecursively(true); // EZScreenPlacement ScreenPlacement = gameObject.GetComponent<EZScreenPlacement>(); // if (ScreenPlacement != null) //ScreenPlacement.SetCamera(UISystem.Instance.UiCamrea); // ScreenPlacement.RenderCamera = UISystem.Instance.UiCamrea; // CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_NEW_ITEM, OnEvent); //CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_PACKAGE_ITEM_CHANGED, OnEvent); // CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_HP,OnEvent); // actionButton.AddInputDelegate(OnActionButtonClicked); // gameObject.SetActiveRecursively(false); // } void OnEvent(GAME_EVENT_ID gAME_EVENT_ID, List <string> vParam) { if (gAME_EVENT_ID == GAME_EVENT_ID.GE_NEW_ITEM) { int id = int.Parse(vParam[0]); CActionItem actionItem = CActionSystem.Instance.GetAction_ItemID(id, false); if (actionItem == null) { return; } actionId = actionItem.GetID(); actionButton.SetActionItemByActionId(actionItem.GetID()); CObject_Item item = actionItem.GetImpl() as CObject_Item; if (item != null) { titleText.Text = UIString.Instance.ParserString_Runtime("#{GET_NEW_ITEM}"); descText.Text = UIString.Instance.ParserString_Runtime("#{NEW_ITEM_DESC}"); } UIWindowMng.Instance.ShowWindow("NewItemWindow"); } //else if (gAME_EVENT_ID == GAME_EVENT_ID.GE_PACKAGE_ITEM_CHANGED) //{ //CActionItem actionItem = CActionSystem.Instance.GetActionByActionId(actionId); //if (actionItem == null) // OnClose(); // } else if (gAME_EVENT_ID == GAME_EVENT_ID.GE_UNIT_HP) { float hp = PlayerMySelf.Instance.GetHPPercent(); if (hp <= 0.4) { CObject_Item item = CDataPool.Instance.GetMedicial(); if (item != null) { actionButton.UpdateItem(item.GetID()); titleText.Text = "血量剩余40%"; descText.Text = UIString.Instance.ParserString_Runtime("#{NEW_ITEM_DESC}"); UIWindowMng.Instance.ShowWindow("NewItemWindow"); } } else { OnClose(); } } }
void UpdateEnchanseSelectedEquip() { ClearEnchanseSelected(); if (mSelectedItem != null) { mEnchanseSelectedAction.SetActionItem(mSelectedItem.GetID()); CObject_Item_Equip equip = mSelectedItem as CObject_Item_Equip; if (equip != null) { int gemCount = equip.GetGemCount(); for (int i = 0; i < gemCount; i++) { int nIdTable = equip.GetGemTableId(i); if (nIdTable != 0) { CObject_Item gemItem = ObjectSystem.Instance.NewItem((uint)nIdTable); CActionItem action = CActionSystem.Instance.GetAction_ItemID(gemItem.GetID(), false); mEnchanseGemInfo[i].enchanseGem.SetActionItemByActionId(action.GetID()); } } } } UpdateEnchanseGemStates(); }
void UpdateEnchanseGemStates() { for (int i = 0; i < mEnchanseGemInfo.Length; i++) { if (mEnchanseGemInfo[i].bFlag == 2) { mEnchanseGemInfo[i].enchanseGem.SetMaskTexture("maskout"); } else if (mEnchanseGemInfo[i].bFlag == 1) { //todo add if (mEnchanseGemInfo[i].nGemType != -1) { CObject_Item gemItem = CDataPool.Instance.UserBag_GetItemById(mEnchanseGemInfo[i].nGemType); CObject_Item newGemItem = ObjectSystem.Instance.NewItem((uint)gemItem.GetIdTable()); CActionItem action = CActionSystem.Instance.GetAction_ItemID(newGemItem.GetID(), false); mEnchanseGemInfo[i].enchanseGem.SetActionItemByActionId(action.GetID()); mEnchanseGemInfo[i].enchanseGem.SetMaskTexture("maskin"); } } } }
/// <summary> /// 升档 /// </summary> void UpdateShengDang() { ClearShengDangContext(); mIsEnableSD = false; if (mSelectedItem != null) { mSDSelectedAction.SetActionItem(mSelectedItem.GetID()); string text = mSelectedItem.GetWhiteAttribute(0); mSDSelectedAttriDesc.Text = UIString.Instance.ParserString_Runtime(text); text = mSelectedItem.GetWhiteAttribute(1); if (text == "") { mSDSelectedAttriDesc2.Hide(true); } else { mSDSelectedAttriDesc2.Hide(false); mSDSelectedAttriDesc2.Text = UIString.Instance.ParserString_Runtime(text); } CActionItem actionItem = LifeAbility.Instance.GetEquipUpdatePreView(mSDSelectedAction.CurrActionItem.GetID()); if (actionItem != null) { mSDPreviewAction.SetActionItemByActionId(actionItem.GetID()); CObject_Item previewItem = mSDPreviewAction.CurrActionItem.GetImpl() as CObject_Item; if (previewItem != null) { text = previewItem.GetWhiteAttribute(0); mSDPreviewAttriDesc.Text = UIString.Instance.ParserString_Runtime(text); text = previewItem.GetWhiteAttribute(1); if (text == "") { mSDPreviewAttriDesc2.Hide(true); } else { mSDPreviewAttriDesc2.Text = UIString.Instance.ParserString_Runtime(text); mSDPreviewAttriDesc2.Hide(false); } } } int nPrescrId = LifeAbility.Instance.GetPrescrID(mSelectedItem.GetIdTable()); if (nPrescrId == -1) { NoPrescrHandler(mSelectedItem.GetIdTable()); mSDOK.controlIsEnabled = false; return; } NoPrescrHandler(-1); //材料 int nCount = LifeAbility.Instance.GetPrescrStuffCount(nPrescrId); //int nMaterial = -1; for (int i = 1; i < nCount; i++) //第一个材料为当前装备,跳过不显示 { Stuff stuff = LifeAbility.Instance.GetPrescrStuff(i, nPrescrId); if (stuff.nID == -1) { mSDMaterials[i - 1].SetActionItem(-1); mSDMaterialTexts[i - 1].Text = ""; continue; } bool bCreateNew = true; if (mSDMaterials[i - 1].CurrActionItem != null) { if (mSDMaterials[i - 1].CurrActionItem.GetIDTable() == stuff.nID) { bCreateNew = false; } else { mSDMaterials[i - 1].CurrActionItem.DestroyImpl(); } } if (bCreateNew) { CObject_Item pItemObj1 = ObjectSystem.Instance.NewItem((uint)stuff.nID); CActionItem_Item actionItem1 = CActionSystem.Instance.GetAction_ItemID(pItemObj1.GetID(), false); mSDMaterials[i - 1].SetActionItemByActionId(actionItem1.GetID()); } int count = CDataPool.Instance.UserBag_CountItemByIDTable(stuff.nID); if (count >= stuff.nNum) { count = stuff.nNum; mIsEnableSD = true; } else { mIsEnableSD = false; } mSDMaterialTexts[i - 1].Text = count + "/" + stuff.nNum; } mSDOK.controlIsEnabled = mIsEnableSD; } }
void UpdateItems(TabMode tab, byte pageindex) { if (tab == TabMode.TAB_BUY) { int nTotalNum = UIInfterface.Instance.GetActionNum(ActionNameType.boothItem); int maxPage = nTotalNum / MAX_ITEM_PERPAGE + 1; if (nTotalNum % MAX_ITEM_PERPAGE != 0) { maxPage++; } if (pageIndex < 1 || pageIndex > maxPage) { return; } int nUnit = Interface.NPCShop.Instance.GetShopType("unit"); int startIndex = (pageIndex - 1) * MAX_ITEM_PERPAGE; for (int i = 0; i < MAX_ITEM_PERPAGE; i++) { CActionItem action = CActionSystem.Instance.EnumAction(i + startIndex, ActionNameType.boothItem); if (action == null) { continue; } if (itemList[i] != null) { itemList[i].SetActionItemByActionId(action.GetID()); } uint price = Interface.NPCShop.Instance.EnumItemPrice(i); if (nUnit == 1) { itemPriceCopper[i].Text = price.ToString(); } itemNames[i].Text = action.GetName(); } if (pageIndex < maxPage) { nextPageBtn.controlIsEnabled = true; } if (pageIndex > 1) { prePageBtn.controlIsEnabled = true; } } else if (tab == TabMode.TAB_REDEEM) { int ntype = Interface.NPCShop.Instance.GetShopType("callback"); if (ntype <= 0) { return; } int nNum = Interface.NPCShop.Instance.GetCallBackNum(); int nUnit = Interface.NPCShop.Instance.GetShopType("unit"); int maxPage = nNum / MAX_ITEM_PERPAGE + 1; if (nNum % MAX_ITEM_PERPAGE != 0) { maxPage++; } if (pageIndex < 1 || pageIndex > maxPage) { return; } int startIndex = (pageIndex - 1) * MAX_ITEM_PERPAGE; for (int i = 0; i < MAX_ITEM_PERPAGE; i++) { CActionItem action = Interface.NPCShop.Instance.EnumCallBackItem(i + startIndex); if (action != null) { if (itemList[i] != null) { itemList[i].SetActionItemByActionId(action.GetID()); } uint price = Interface.NPCShop.Instance.EnumItemSoldPrice(i); if (nUnit == 1) { itemPriceCopper[i].Text = price.ToString(); } itemNames[i].Text = action.GetName(); } } if (pageIndex < maxPage) { nextPageBtn.controlIsEnabled = true; } if (pageIndex > 1) { prePageBtn.controlIsEnabled = true; } } }