void InitIsoBlockPage() { UISkillWndCtrl uiSkill = GameUI.Instance.mSkillWndCtrl; if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckUnlockBuildBlockIso()) { return; } } if (!_initIosBlockPage) { mWndCtrl.ClearIsoList(); mWndCtrl.ClearCostList(); m_IsoHeaders = new List <BSIsoHeadData>(PEBuildingMan.Self.ExtractTheHeaders()); foreach (BSIsoHeadData header in m_IsoHeaders) { Texture2D tex = new Texture2D(32, 32, TextureFormat.ARGB32, false); tex.LoadImage(header.IconTex); mWndCtrl.AddIsoListItem(header.Name, tex); } mWndCtrl.IsoItemOnClick += OnIsoClick; mWndCtrl.ResetIsoPostion(); _initIosBlockPage = true; } }
void InitVoxelPage() { if (!_initVoxelPage) { UISkillWndCtrl uiSkill = GameUI.Instance.mSkillWndCtrl; if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckUnlockBuildBlockVoxel()) { return; } } m_VoxelProtoItems = BSVoxelMatMap.GetAllProtoItems(); foreach (int id in m_VoxelProtoItems) { ItemProto proto = ItemProto.Mgr.Instance.Get(id); int index = mWndCtrl.AddVoxelMatListItem(proto.icon[0], "Icon"); mWndCtrl.mVoxelMatList[index].SetItemID(proto.id); } mWndCtrl.ToolTip += OnItemToolTip; mWndCtrl.TextureItemOnClick += OnVoxelMatItemClick; mWndCtrl.VoxelTypeOnClick += OnVoxelTypeClick; mWndCtrl.ResetVoxelPostion(); _initVoxelPage = true; } }
private void BtnBrush3_OnClick() { UISkillWndCtrl uiSkill = GameUI.Instance.mSkillWndCtrl; if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckUnlockBuildBlockBevel()) { mDiagonalBtn.checkBox.isChecked = false; return; } } mDiagonalBtn.checkBox.isChecked = true; UIBuildBlock.Instance.CreateBrush(UIBuildBlock.BrushType.bt_inclined); mSaveWndCtrl.Hide(); }
void OnInitMenuList() { // Menu List UISkillWndCtrl uiSkill = GameUI.Instance.mSkillWndCtrl; if (uiSkill == null) { return; } foreach (UIBuildWndItem item in mMenuCtrl.mMenuList) { if (item.mTargetItemType == UIBuildWndItem.ItemType.mBlockMat) { ItemAsset.ItemProto proto = ItemAsset.ItemProto.GetItemData(item.ItemId); if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckBuildBlockLevel(proto.level)) { item.IsActive = false; } else { item.IsActive = true; } } } else if (item.mTargetItemType == UIBuildWndItem.ItemType.mBlockPattern) { int index = item.mTargetIndex; if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckBuildShape(index)) { item.IsActive = false; } else { item.IsActive = true; } } } } }
void Update() { if (DragObejct != null) { if (Input.GetMouseButtonUp(0)) { Destroy(DragObejct); DragObejct = null; if (DragItem != null) { if (DragItem.mItemType == UIBuildWndItem.ItemType.mMenu) { UIBlockSaver.Instance.RemoveData((mBoxBars.PageIndex - 1) * c_MaxMenuItems + DragItem.mIndex); UpdateMenuItems(mBoxBars.PageIndex); DragItem = null; } } } } // ShortCut if (PeInput.Get(PeInput.LogicFunction.QuickBar1)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[0]); } mMenuList[0].PlayGridEffect(); } else if (PeInput.Get(PeInput.LogicFunction.QuickBar2)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[1]); } mMenuList[1].PlayGridEffect(); } else if (PeInput.Get(PeInput.LogicFunction.QuickBar3)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[2]); } mMenuList[2].PlayGridEffect(); } else if (PeInput.Get(PeInput.LogicFunction.QuickBar4)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[3]); } mMenuList[3].PlayGridEffect(); } else if (PeInput.Get(PeInput.LogicFunction.QuickBar5)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[4]); } mMenuList[4].PlayGridEffect(); } else if (PeInput.Get(PeInput.LogicFunction.QuickBar6)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[5]); } mMenuList[5].PlayGridEffect(); } else if (PeInput.Get(PeInput.LogicFunction.QuickBar7)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[6]); } mMenuList[6].PlayGridEffect(); } else if (PeInput.Get(PeInput.LogicFunction.QuickBar8)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[7]); } mMenuList[7].PlayGridEffect(); } else if (PeInput.Get(PeInput.LogicFunction.QuickBar9)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[8]); } mMenuList[8].PlayGridEffect(); } else if (PeInput.Get(PeInput.LogicFunction.QuickBar10)) { if (onQuickBarFunc != null) { onQuickBarFunc(mMenuList[9]); } mMenuList[9].PlayGridEffect(); } // Short Cut For Brush if (PeInput.Get(PeInput.LogicFunction.Build_Shortcut1)) { if (!mPointBtn.checkBox.isChecked) { mPointBtn.checkBox.isChecked = true; BtnBrush1_OnClick(); } } else if (PeInput.Get(PeInput.LogicFunction.Build_Shortcut2)) { if (!mBoxBtn.checkBox.isChecked) { mBoxBtn.checkBox.isChecked = true; BtnBrush2_OnClick(); } } else if (PeInput.Get(PeInput.LogicFunction.Build_Shortcut3)) { if (!mDiagonalBtn.checkBox.isChecked) { UISkillWndCtrl uiSkill = GameUI.Instance.mSkillWndCtrl; if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckUnlockBuildBlockBevel()) { return; } } mDiagonalBtn.checkBox.isChecked = true; BtnBrush3_OnClick(); } } else if (PeInput.Get(PeInput.LogicFunction.Build_Shortcut4)) { if (!mSelectBtn.checkBox.isChecked) { mSelectBtn.checkBox.isChecked = true; BtnBrush4_OnClick(); } } else if (PeInput.Get(PeInput.LogicFunction.Build_Shortcut5)) { if (!mSelectBlockBtn.checkBox.isChecked) { mSelectBlockBtn.checkBox.isChecked = true; BtnBrush5_OnClick(); } } else if (PeInput.Get(PeInput.LogicFunction.Build_Shortcut6)) { BtnSaveOnClick(); } else if (PeInput.Get(PeInput.LogicFunction.Build_Shortcut7)) { BtnMenuOnClick(); } if (PeInput.Get(PeInput.LogicFunction.PrevQuickBar)) { mBoxBars.BtnPageUpOnClick(); } if (PeInput.Get(PeInput.LogicFunction.NextQuickBar)) { mBoxBars.BtnPageDnOnClick(); } //if (Input.GetKeyDown(KeyCode.Tab)) //{ // if (mPointBtn.checkBox.isChecked) // { // if (onQuickSwitchPointBrush != null) // onQuickSwitchPointBrush(); // } // //else if (mDiagonalBtn.checkBox.isChecked) // //{ // // if (onQuickSwitchDiagonalBrush != null) // // onQuickSwitchDiagonalBrush(); // //} // else if (mBoxBtn.checkBox.isChecked) // { // if (onQuickSwitchBoxBrush != null) // onQuickSwitchBoxBrush(); // } //} // if (Pathea.PeCreature.Instance.mainPlayer != null) { Pathea.PackageCmpt pkg = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PackageCmpt>(); foreach (UIBuildWndItem item in mMenuList) { if (item.mTargetItemType == UIBuildWndItem.ItemType.mBlockMat) { item.SetNumber(pkg.GetItemCount(item.ItemId).ToString()); } else if (item.mTargetItemType == UIBuildWndItem.ItemType.mVoxelType) { int proto_id = PEBuildingMan.GetVoxelItemProtoID((byte)item.ItemId); item.SetNumber(pkg.GetItemCount(proto_id).ToString()); } else if (item.mTargetItemType == UIBuildWndItem.ItemType.mBlockPattern) { item.SetNumber(mBulidWnd.mBlockPatternList[item.mTargetIndex].mNumber.text); } else { item.SetNumber(""); } } } }
// On Skill Refresh void OnRefreshSkill(UISkillWndCtrl uiSkill) { if (!RandomMapConfig.useSkillTree) { return; } // Block Material foreach (UIBuildWndItem item in mWndCtrl.mBlockMatList) { ItemProto proto = ItemProto.Mgr.Instance.Get(item.ItemId); if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckBuildBlockLevel(proto.level)) { item.IsActive = false; } else { item.IsActive = true; } } } // Block Pattern foreach (UIBuildWndItem item in mWndCtrl.mBlockPatternList) { int index = item.mIndex; if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckBuildShape(index)) { item.IsActive = false; } else { item.IsActive = true; } } } // Menu List foreach (UIBuildWndItem item in mMenuCtrl.mMenuList) { if (item.mTargetItemType == UIBuildWndItem.ItemType.mBlockMat) { ItemAsset.ItemProto proto = ItemAsset.ItemProto.GetItemData(item.ItemId); if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckBuildBlockLevel(proto.level)) { item.IsActive = false; } else { item.IsActive = true; } } } else if (item.mTargetItemType == UIBuildWndItem.ItemType.mBlockPattern) { int index = item.mTargetIndex; if (uiSkill._SkillMgr != null) { if (!uiSkill._SkillMgr.CheckBuildShape(index)) { item.IsActive = false; } else { item.IsActive = true; } } } } }
// add game ui void InstantiateGameUI() { // gameMain GameObject gameUI = AddUIPrefab(GameMainPrefab, gameObject.transform); mUIGameMenuCtrl = gameUI.GetComponentsInChildren <UIGameMenuCtrl>(true)[0]; mUIGameMenuCtrl.Show(); mUIMainMidCtrl = gameUI.GetComponentsInChildren <UIMainMidCtrl>(true)[0]; mUIMainMidCtrl.Show(); mUIMinMapCtrl = gameUI.GetComponentsInChildren <UIMinMapCtrl>(true)[0]; mUIMinMapCtrl.Show(); mNPCTalk = gameUI.GetComponentsInChildren <UINPCTalk>(true)[0]; mNPCTalk.Hide(); mNPCSpeech = gameUI.GetComponentInChildren <UINpcSpeech>(); mServantTalk = gameUI.GetComponentsInChildren <UIServantTalk>(true)[0]; mServantTalk.Hide(); gameUI.SetActive(true); //UI System gameUI = AddUIPrefab(SytemPrefab, gameObject.transform); mSystemMenu = gameUI.GetComponentInChildren <UISystemMenu>(); mSystemMenu.e_OnShow += OnSystemWndShow; mSystemMenu.e_OnHide += OnSystemWndHide; mOption = gameUI.GetComponentInChildren <UIOption>(); mOption.e_OnShow += OnSystemWndShow; mOption.e_OnHide += OnSystemWndHide; mSaveLoad = gameUI.GetComponentInChildren <UISaveLoad>(); mSaveLoad.e_OnShow += OnSystemWndShow; mSaveLoad.e_OnHide += OnSystemWndHide; gameUI.SetActive(true); //Map gameUI = AddUIPrefab(worldMapPrefab, gameObject.transform); mUIWorldMap = gameUI.GetComponent <UIWorldMapCtrl>(); gameUI.SetActive(false); // UI Build gameUI = AddUIPrefab(buildPrefab, gameObject.transform); mBuildBlock = gameUI.GetComponent <UIBuildBlock>(); gameUI.SetActive(false); // Tip end gameUI = AddUIPrefab(tipsWmdPrefab, gameObject.transform); mTipsCtrl = gameUI.GetComponent <UITips>(); gameUI.SetActive(true); // TipRecords gameUI = AddUIPrefab(tipRecordsMgrPrefab, gameObject.transform); mTipRecordsMgr = gameUI.GetComponent <UITipRecordsMgr>(); gameUI.SetActive(false); //wnd // player info gameUI = AddUIPrefab(playerInfoPrefab, tsCenter); mUIPlayerInfoCtrl = gameUI.GetComponent <UIPlayerInfoCtrl>(); gameUI.transform.localPosition = UIDefaultPostion.Instance.pos_PlayerInfo; gameUI.SetActive(false); mUIPlayerInfoCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_PlayerInfo; // Item Package gameUI = AddUIPrefab(ItemPackagePrefab, tsCenter); mItemPackageCtrl = gameUI.GetComponent <UIItemPackageCtrl>(); gameUI.SetActive(false); mItemPackageCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_ItemPackge; // Npc Strage gameUI = AddUIPrefab(npcStoragePrefab, tsCenter); mNpcStrageCtrl = gameUI.GetComponent <UINpcStorageCtrl>(); gameUI.SetActive(false); mNpcStrageCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_NpcStorage; // Compound Wnd gameUI = AddUIPrefab(compoundWndPrefab, tsCenter); mCompoundWndCtrl = gameUI.GetComponent <UICompoundWndControl>(); gameUI.SetActive(false); mCompoundWndCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_Compound; // Servant Wnd gameUI = AddUIPrefab(servantWndPrefab, tsCenter); mServantWndCtrl = gameUI.GetComponent <UIServantWnd>(); gameUI.SetActive(false); mServantWndCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_Servant; // Npc gameUI = AddUIPrefab(npcGuiPrefab, tsCenter); mNpcWnd = gameUI.GetComponent <UINpcWnd>(); gameUI.SetActive(false); mNpcWnd.transform.localPosition = UIDefaultPostion.Instance.pos_Npc; // Mission Wnd gameUI = AddUIPrefab(missionWndPrefab, tsCenter); mUIMissionWndCtrl = gameUI.GetComponent <UIMissionWndCtrl>(); gameUI.SetActive(false); // MissionTrack Wnd gameUI = AddUIPrefab(missionTrackWndPrefab, tsCenterOther); mMissionTrackWnd = gameUI.GetComponent <UIMissionTrackCtrl>(); mMissionTrackWnd.transform.localPosition = UIDefaultPostion.Instance.pos_MissionTruck; // mMissionTrackWnd.transform.localPosition = new Vector3 (856,162,0); mMissionTrackWnd.transform.localPosition = new Vector3(Screen.width / 2 - 145, 35, 0); gameUI.SetActive(false); // Get Item Wnd gameUI = AddUIPrefab(itemGetWndPrefab, tsCenter); mItemGet = gameUI.GetComponent <UIItemGet>(); gameUI.SetActive(false); // Item Option Wnd gameUI = AddUIPrefab(itemOpGuiPrefab, tsCenter); mItemOp = gameUI.GetComponent <UIItemOp>(); gameUI.SetActive(false); // Shop Wnd gameUI = AddUIPrefab(shopGuiPrefab, tsCenter); mShopWnd = gameUI.GetComponent <UIShopWnd>(); gameUI.SetActive(false); mShopWnd.transform.localPosition = UIDefaultPostion.Instance.pos_Shop; // Item Box gameUI = AddUIPrefab(itemBoxGuiPrefab, tsCenter); mItemBox = gameUI.GetComponent <UIItemBox>(); gameUI.SetActive(false); // Repair Wnd gameUI = AddUIPrefab(repairWndGuiPrefab, tsCenter); mRepair = gameUI.GetComponent <UIRepairWnd>(); gameUI.SetActive(false); mRepair.transform.localPosition = UIDefaultPostion.Instance.pos_Repair; // Power Plant Solar Wnd gameUI = AddUIPrefab(powerPlantSolarPrefab, tsCenter); mPowerPlantSolar = gameUI.GetComponent <UIPowerPlantSolar>(); gameUI.SetActive(false); mPowerPlantSolar.transform.localPosition = UIDefaultPostion.Instance.pos_PowerPlant; // Revive Gui Wnd gameUI = AddUIPrefab(reviveGuiPrefab, tsCenter); mRevive = gameUI.GetComponent <UIRevive>(); gameUI.SetActive(false); // Ware House Wnd gameUI = AddUIPrefab(wareHouseGuiPrefab, tsCenter); mWarehouse = gameUI.GetComponent <UIWarehouse>(); gameUI.SetActive(false); mWarehouse.transform.localPosition = UIDefaultPostion.Instance.pos_WareHouse; //colony Wnd gameUI = AddUIPrefab(colonyWndPrefab, tsCenter); mCSUI_MainWndCtrl = gameUI.GetComponent <CSUI_MainWndCtrl>(); gameUI.SetActive(false); //phone Wnd gameUI = AddUIPrefab(phoneWndPrefab, tsCenter); mPhoneWnd = gameUI.GetComponent <UIPhoneWnd>(); gameUI.SetActive(false); // skill wnd gameUI = AddUIPrefab(skillWndPrefab, tsCenter); mSkillWndCtrl = gameUI.GetComponent <UISkillWndCtrl>(); gameUI.SetActive(false); // workshop wnd gameUI = AddUIPrefab(workshopPrefb, tsCenter); mWorkShopCtrl = gameUI.GetComponent <UIWorkShopCtrl>(); gameUI.SetActive(false); //information wnd gameUI = AddUIPrefab(informationPrefab, tsCenter); mTeamInfoMgr = gameUI.GetComponent <CSUI_TeamInfoMgr>(); gameUI.SetActive(false); // railwayPoint gameUI = AddUIPrefab(railwayPonitPrefab, tsCenter); mRailwayPoint = gameUI.GetComponent <RailwayPointGui_N>(); gameUI.SetActive(false); // mallWndPrefab if (Pathea.PeGameMgr.IsMulti) { gameUI = AddUIPrefab(mallWndPrefab, tsCenter); mMallWnd = gameUI.GetComponent <UIMallWnd>(); gameUI.SetActive(false); } //UI Adminstrator //AdminUI gameUI = AddUIPrefab(AdministratorPrefab, tsCenter); mAdminstratorWnd = gameUI.GetComponent <UIAdminstratorWnd>(); gameUI.SetActive(false); // Driving UI gameUI = AddUIPrefab(drivingPrefab, tsCenterOther); mDrivingCtrl = gameUI.GetComponent <UIDrivingCtrl>(); gameUI.SetActive(false); // Custom stopwatch UI gameUI = AddUIPrefab(stopwatchPrefab, transform); mStopwatchList = gameUI.GetComponent <UIStopwatchList>(); gameUI.SetActive(false); // Custom npc talk UI gameUI = AddUIPrefab(npcWndCustomPrefab, tsCenter); mNpcDialog = gameUI.GetComponent <UINpcDialog>(); // Custom npc mission ui gameUI = AddUIPrefab(missionWndCustomPrefab, tsCenter); mMissionGoal = gameUI.GetComponent <UIMissionGoal>(); // Custom MissionTrack ui gameUI = AddUIPrefab(missionTrackCustomPrefab, tsCenterOther); mCustomMissionTrack = gameUI.GetComponent <UIMissionTrack>(); mCustomMissionTrack.transform.localPosition = UIDefaultPostion.Instance.pos_MissionTruck; // mMissionTrackWnd.transform.localPosition = new Vector3 (856,162,0); mCustomMissionTrack.transform.localPosition = new Vector3(Screen.width / 2 - 145, 35, 0); //lz-2016.10.22 KickstarterCtrl gameUI = AddUIPrefab(mKickstarterCtrlPrefab, tsCenter); mKickstarterCtrl = gameUI.GetComponent <KickstarterCtrl>(); gameUI.SetActive(false); //lz-2016.11.07 NpcTalkHistoryWnd gameUI = AddUIPrefab(mNpcTalkHistoryPrefab, tsCenter); mNpcTalkHistoryWnd = gameUI.GetComponent <NpcTalkHistoryWnd>(); gameUI.SetActive(false); // itemsTrack Wnd gameUI = AddUIPrefab(itemsTrackWndPrefab, tsCenterOther); mItemsTrackWnd = gameUI.GetComponent <UIItemsTrackCtrl>(); mItemsTrackWnd.transform.localPosition = mMissionTrackWnd.transform.localPosition + new Vector3(0, 170f, 0); gameUI.SetActive(false); }