Esempio n. 1
0
        public void InitCampCaptive(EnemyType enemyType)
        {
            GameObject gameObject     = null;
            string     gameObjectName = null;
            string     name           = null;
            string     icon           = null;
            Vector3    pos            = Vector3.zero;
            float      trainTime      = 0;

            switch (enemyType)
            {
            case EnemyType.Elf:
                gameObjectName = "CaptiveCamp_Elf";
                name           = "俘兵兵营";
                icon           = "CaptiveCamp";
                trainTime      = 3;
                break;

            default:

                Debug.LogError(GetType() + "/InitCamp()/Init Failed.The enemyType is not Contained: " + enemyType.ToString());
                break;
            }

            gameObject = GameObject.Find(gameObjectName);
            pos        = UnityTool.FindChild(gameObject, "TrainPoint").transform.position;
            CaptiveCamp camp = new CaptiveCamp(gameObject, name, icon, enemyType, pos, trainTime);

            gameObject.AddComponent <CampOnClick>().Camp = camp;

            mCaptiveCampDIc.Add(enemyType, camp);
        }
        public override void Init()
        {
            base.Init();
            GameObject canvas = GameObject.Find("Canvas");

            mRootUI = UnityTool.FindChild(canvas, "CampInfoUI");

            mCampIcon         = UITool.FindChild <Image>(mRootUI, "CampIcon");
            mCampName         = UITool.FindChild <Text>(mRootUI, "CampName");
            mCampLevel        = UITool.FindChild <Text>(mRootUI, "CampLv");
            mWeaponLevel      = UITool.FindChild <Text>(mRootUI, "WeaponLv");
            mCampUpgradeBtn   = UITool.FindChild <Button>(mRootUI, "CampLvBtn");
            mWeaponUpgradeBtn = UITool.FindChild <Button>(mRootUI, "WeaponLvBtn");
            mTrainBtn         = UITool.FindChild <Button>(mRootUI, "TrainBtn");
            mCancelTrainBtn   = UITool.FindChild <Button>(mRootUI, "CancelTrainBtn");
            mTrainBtnText     = UITool.FindChild <Text>(mRootUI, "TrainBtnText");
            mAliveCount       = UITool.FindChild <Text>(mRootUI, "AliveCount");
            mTrainingCount    = UITool.FindChild <Text>(mRootUI, "TrainingCount");
            mTrainingTime     = UITool.FindChild <Text>(mRootUI, "TrainTime");

            mTrainBtn.onClick.AddListener(OnTrainBtnClick);
            mCancelTrainBtn.onClick.AddListener(OnCancelTrainBtnClick);
            mCampUpgradeBtn.onClick.AddListener(OnCampUpgradeBtnClick);
            mWeaponUpgradeBtn.onClick.AddListener(OnWeaponUpgradeBtnClick);

            Hide();
        }
        public override void Init()
        {
            base.Init();
            GameObject canvas = GameObject.Find("Canvas");

            mRootUI = UnityTool.FindChild(canvas, "GameStateUI");

            GameObject Heart1 = UnityTool.FindChild(mRootUI, "Heart1");
            GameObject Heart2 = UnityTool.FindChild(mRootUI, "Heart2");
            GameObject Heart3 = UnityTool.FindChild(mRootUI, "Heart3");

            mHeartLst = new List <GameObject>();
            mHeartLst.Add(Heart1);
            mHeartLst.Add(Heart2);
            mHeartLst.Add(Heart3);

            mSoldierAlive   = UITool.FindChild <Text>(mRootUI, "SoldierAlive");
            mEnemyAlive     = UITool.FindChild <Text>(mRootUI, "EnemyAlive");
            mStageCount     = UITool.FindChild <Text>(mRootUI, "StageCount");
            mPauseBtn       = UITool.FindChild <Button>(mRootUI, "PauseBtn");
            mEnergySlider   = UITool.FindChild <Slider>(mRootUI, "EnergySlider");
            mEnergyCount    = UITool.FindChild <Text>(mRootUI, "EnergyCount");
            mBackMenuButton = UITool.FindChild <Button>(mRootUI, "BackMenuButton");
            mMessage        = UITool.FindChild <Text>(mRootUI, "Message");
            mGameOver       = UnityTool.FindChild(mRootUI, "GameOver");

            mMessage.text = "";
            mGameOver.SetActive(false);
        }
Esempio n. 4
0
        public static T FindChild <T>(GameObject parent, string childName)
        {
            GameObject uiGO = UnityTool.FindChild(parent, childName);
            T          t    = uiGO.GetComponent <T>();

            if (t == null)
            {
                Debug.LogError("/()/ There is not  " + t.ToString() + " on the " + childName);
            }
            return(t);
        }
        public override void Init()
        {
            base.Init();
            GameObject canvas = GameObject.Find("Canvas");

            mRootUI = UnityTool.FindChild(canvas, "GamePauseUI");

            mCurStage       = UITool.FindChild <Text>(mRootUI, "CurStage");
            mCoutinueButton = UITool.FindChild <Button>(mRootUI, "CoutinueButton");
            mBackMenuButton = UITool.FindChild <Button>(mRootUI, "BackMenuButton");

            Hide();
        }
Esempio n. 6
0
        private void InitCamp(SoldierType soldierType)
        {
            GameObject gameObject     = null;
            string     gameObjectName = null;
            string     name           = null;
            string     icon           = null;
            Vector3    pos            = Vector3.zero;
            float      trainTime      = 0;

            switch (soldierType)
            {
            case SoldierType.Rookie:
                gameObjectName = "SoldierCamp_Rookie";
                name           = "新手兵营";
                icon           = "RookieCamp";
                trainTime      = 3;
                break;

            case SoldierType.Sergeant:
                gameObjectName = "SoldierCamp_Sergeant";
                name           = "中士兵营";
                icon           = "SergeantCamp";
                trainTime      = 4;
                break;

            case SoldierType.Captain:
                gameObjectName = "SoldierCamp_Captain";
                name           = "上尉兵营";
                icon           = "CaptainCamp";
                trainTime      = 5;
                break;

            default:

                Debug.LogError(GetType() + "/InitCamp()/Init Failed.The soldierType is not Contained: " + soldierType.ToString());
                break;
            }

            gameObject = GameObject.Find(gameObjectName);
            pos        = UnityTool.FindChild(gameObject, "TrainPoint").transform.position;
            SoldierCamp camp = new SoldierCamp(gameObject, name, icon, soldierType, pos, trainTime);

            gameObject.AddComponent <CampOnClick>().Camp = camp;

            mSoldierCampDIc.Add(soldierType, camp);
        }
Esempio n. 7
0
        public override void Init()
        {
            base.Init();
            GameObject canvas = GameObject.Find("Canvas");

            mRootUI = UnityTool.FindChild(canvas, "SoldierInfoUI");

            mSoldierIcon = UITool.FindChild <Image>(mRootUI, "SoldierIcon");
            mSoldierName = UITool.FindChild <Text>(mRootUI, "SoldierName");
            mHp          = UITool.FindChild <Text>(mRootUI, "Hp");
            mHPSlider    = UITool.FindChild <Slider>(mRootUI, "HPSlider");
            mLevel       = UITool.FindChild <Text>(mRootUI, "Level");
            mAtk         = UITool.FindChild <Text>(mRootUI, "Atk");
            mAtkRange    = UITool.FindChild <Text>(mRootUI, "AtkRange");
            mMoveSpeed   = UITool.FindChild <Text>(mRootUI, "MoveSpeed");

            Hide();
        }