Beispiel #1
0
    public void InitData(string map_name, List <TowerInfo> tower_list)
    {
        mTowerList = tower_list;
        AudioMananger.PlayMusic("music_fuben");
        Camera.main.transform.localPosition        = new Vector3(3, 25, 3.5f); //还原镜头位置 因为镜头可以改变
        Camera.main.fieldOfView                    = 34;                       //还原镜头视野
        MapManager.mMapObj.transform.localPosition = Vector3.zero;
        BattleManager.InitData(this, MapManager.GetMapPath(map_name));
        RefreshLife();
        mObjTowerContent.SetActive(false);
        RefreshTimeDownCount(0);
        mTextWave.text  = "";
        mTwaveTime.text = "";

        for (int i = 0; i < tower_list.Count; i++)
        {
            GameObject obj = Instantiate(mBtnBaseTower);
            obj.SetActive(true);
            obj.GetComponentInChildren <Text>().text = tower_list[i].BtnName;
            obj.GetComponentInChildren <Button>().onClick.AddListener(() =>
            {
                OnButtonClick("btn_Tower", obj);
            });
            obj.transform.SetParent(mObjTowerContent.transform);
            mButtonList.Add(obj);
        }
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     AudioMananger.InitData();
     AudioMananger.PlayMusic("music_login");
     MapManager.mMapObj = GameObject.Find("map"); //初始化map
     UIManager.EnterUI <UI_Main>();               //载入界面
 }
 public override void OnButtonClick(string name, GameObject obj)
 {
     switch (name)
     {
     case "btn_return":
         BattleManager.Clear();
         UIManager.ExitUI(this);
         UIManager.ExitALLUI();         //关闭所有界面
         AudioMananger.PlayMusic("music_login");
         UIManager.EnterUI <UI_Main>(); //打开开始界面
         break;
     }
 }