public override void Init()
    {
        base.Init();

        GameObject startBtn = transform.Find("StartGame").gameObject;

        GameUIEventListener.Get(startBtn).onClick = StartCB;

        GameObject backBtn = transform.Find("Back").gameObject;

        GameUIEventListener.Get(backBtn).onClick = BackCB;

        GameObject watchBtn = transform.Find("WatchAD").gameObject;

        GameUIEventListener.Get(watchBtn).onClick = WatchAD;

        UILabel watchADCountLabel = watchBtn.transform.Find("Label").GetComponent <UILabel>();

        watchADCountLabel.text = "+" + GameConst.WATCH_AD_REWAER_COUNT;

        itemList = transform.Find("ItemList").GetComponent <UIScrollView>();


        //combo label
        combolabel = transform.Find("TopLeft").Find("ComboIcon").Find("CountLabel").GetComponent <GamePadScoresLabel>();
        int combocount = PlayerPrefs.GetInt(GameConst.USERDATANAME_COMBO_COUNT, 0);

        combolabel.Init(combocount);
        combolabel.SetScores(combocount);

        //item list
        UIGrid grid = itemList.transform.Find("Grid").GetComponent <UIGrid>();

        List <MapObjectConf> objList = ConfigManager.confMapObjectManager.datas;

        GameObject itemObjRes = Resources.Load("Prefabs/UI/ShopInGameObjItem") as GameObject;

        int selRole = PlayerPrefs.GetInt(GameConst.USERDATANAME_SELECT_ROLE, 0);

        for (int i = 0; i < objList.Count; i++)
        {
            MapObjectConf     conf    = objList[i];
            GameObject        itemObj = NGUITools.AddChild(grid.gameObject, itemObjRes);
            ShopInGameObjItem item    = itemObj.GetComponent <ShopInGameObjItem>();

            int islock = PlayerPrefs.GetInt(GameConst.USERDATANAME_UNLOCK_ROLE + conf.objid, 0);
            item.Init(conf, islock);

            objItemList.Add(item);
            item.SetColor((conf.price != -1 && islock == 0) ? lockColor : unLockColor,
                          selRole == conf.objid ? selColor : normalColor);
        }
        grid.Reposition();
        itemList.ResetPosition();
    }
    public override void Init()
    {
        base.Init();
        reviveBtn = transform.Find("reviveBtn").gameObject;
        GameUIEventListener.Get(reviveBtn).onClick = Revive;

        cancelBtn = transform.Find("cancelBtn").gameObject;
        GameUIEventListener.Get(cancelBtn).onClick = Cancel;

        timeLabel = transform.Find("Time").GetComponent <GamePadScoresLabel>();
        timeLabel.Init(5);
    }
Beispiel #3
0
    public override void Init()
    {
        base.Init();
        scoreslabel = transform.Find("scores").Find("Label").GetComponent <GamePadScoresLabel>();
        scoreslabel.Init(0);
        Transform comboIcom = transform.Find("TopLeft").Find("ComboIcon");

        combolabel = comboIcom.Find("CountLabel").GetComponent <GamePadScoresLabel>();
        combolabel.Init(combocount);
        combocount = PlayerPrefs.GetInt(GameConst.USERDATANAME_COMBO_COUNT, 0);
        combolabel.SetScores(combocount);

        Camera  uicamera  = GameObject.Find("UI Root").transform.Find("Camera").GetComponent <Camera>();
        Vector3 screenpos = uicamera.WorldToScreenPoint(comboIcom.position);

        comboLabelPos = GameCommon.ScreenPositionToWorld(InGameManager.GetInstance().gamecamera, screenpos);


        GameObject pausebtn = transform.Find("TopRight").Find("pause").gameObject;

        GameUIEventListener.Get(pausebtn).onClick = PauseBtnCB;
    }