예제 #1
0
    // 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);
    }
예제 #2
0
 void Awake()
 {
     mInstance = this;
     UIEventListener.Get(driveHelpBtn.gameObject).onClick += OnTipsBtnClick;
     InitDriveHelpState();
 }