示例#1
0
    public void SelItem(ShopInGameObjItem objitem)
    {
        MapObjectConf conf   = objitem.conf;
        int           islock = PlayerPrefs.GetInt(GameConst.USERDATANAME_UNLOCK_ROLE + conf.objid, 0);

        if (conf.price != -1 && islock == 0)
        {
            int combocount = PlayerPrefs.GetInt(GameConst.USERDATANAME_COMBO_COUNT, 0);
            if (combocount < conf.price)
            {
                objitem.Nofull();
                return;
            }
            combocount -= conf.price;
            PlayerPrefs.SetInt(GameConst.USERDATANAME_COMBO_COUNT, combocount);
            PlayerPrefs.SetInt(GameConst.USERDATANAME_UNLOCK_ROLE + conf.objid, 1);
            combolabel.SetScores(combocount);
            objitem.Unlock();
        }

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

        for (int i = 0; i < objItemList.Count; i++)
        {
            ShopInGameObjItem item = objItemList[i];
            if (item.conf.objid == selRole)
            {
                item.SetColor(unLockColor, normalColor);
                break;
            }
        }
        objitem.SetColor(unLockColor, selColor);
        PlayerPrefs.SetInt(GameConst.USERDATANAME_SELECT_ROLE, conf.objid);
    }
示例#2
0
 public void SetScores(int val, bool isCombo)
 {
     scoreslabel.SetScores(val);
     if (isCombo)
     {
         combocount++;
         PlayerPrefs.SetInt(GameConst.USERDATANAME_COMBO_COUNT, combocount);
         combolabel.SetScores(combocount);
     }
 }
示例#3
0
    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();
    }
示例#4
0
    public override void Init()
    {
        base.Init();
        scoreslabel = transform.Find("scores").Find("Label").GetComponent <GamePadScoresLabel>();
        Transform comboIcom = transform.Find("TopLeft").Find("ComboIcon");

        combolabel = comboIcom.Find("CountLabel").GetComponent <GamePadScoresLabel>();
        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);
    }
 // Update is called once per frame
 void Update()
 {
     if (showAD)
     {
         return;
     }
     if (timeCount <= 0)
     {
         return;
     }
     timeCount -= Time.deltaTime;
     if (timeCount <= 0)
     {
         Cancel(null);
         return;
     }
     if ((int)timeCount != nowTime)
     {
         nowTime = (int)timeCount;
         //timeLabel.text = nowTime + "";
         timeLabel.SetScores(nowTime);
     }
 }
示例#6
0
 public void SetScores(int val)
 {
     scoreslabel.SetScores(val);
 }