Exemple #1
0
    public override void OnBtnOk()
    {
        BCSoundPlayer.Play(MusicEnum.button);

        DataPlayerController dpc       = DataPlayerController.getInstance();
        WGDataController     _dataCtrl = WGDataController.Instance;
        int numleft   = _dataCtrl.GetCollectionOwnNum(itemID1);
        int numMiddle = _dataCtrl.GetCollectionOwnNum(itemID2);
        int numRight  = _dataCtrl.GetCollectionOwnNum(itemID3);

        if (Mathf.Min(numleft, numMiddle, numRight) >= mSellCount)
        {
            _dp.Coin += Mathf.CeilToInt(mGotCoin + 0.5f);

            dpc.addCollectionNum(itemID1, -mSellCount);
            dpc.addCollectionNum(itemID2, -mSellCount);
            dpc.addCollectionNum(itemID3, -mSellCount);
//			Dictionary<string, object> dic = new Dictionary<string, object>();
//			dic.Add("SellNum",mSellCount.ToString());
//			//WG.SLog("=actionId="+WGStrings.getText(9005)+col1.groupdes+"==parameters="+SDK.Serialize(dic));
//
//			TalkingDataGA.OnEvent(WGStrings.getText(9005)+col1.groupdes, dic);
//#endif



            DataPlayerController.getInstance().saveDataPlayer();

            WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN);
        }
        WGGameUIView.Instance.freshMenuButton(2);
        base.OnBtnOk();
    }
Exemple #2
0
    public void freshWithCollectionID(int id, Color color)
    {
        WGDataController _dataCtrl = WGDataController.Instance;

        mItemColID  = id;
        labNum.text = _dataCtrl.GetCollectionOwnNum(id).ToString();

        BCObj obj = _dataCtrl.GetBCObj(id);

        if (obj != null)
        {
            GameObject go = Instantiate(obj.goRes, Vector3.zero, Quaternion.Euler(270, 0, 0)) as GameObject;

            Vector3 scale = go.transform.localScale;
            go.transform.parent        = this.transform;
            go.transform.localScale    = Vector3.one * 14.6f;
            go.transform.localPosition = goCollectionPanel.transform.localPosition;
            go.transform.parent        = goCollectionPanel.transform;

            Destroy(go.GetComponent <Rigidbody>());
            Destroy(go.GetComponent <BoxCollider>());
            goCollectionPanel.GetComponent <TweenRotation>().delay = Random.Range(0, 1);
        }

        spBackground.color = color;
        spBottom.color     = color;
    }
Exemple #3
0
    public void freshItem()
    {
        WGDataController _dataCtrl = WGDataController.Instance;


        Dictionary <int, List <int> > dicCollections = new Dictionary <int, List <int> >();

        for (int i = 0; i < _dataCtrl.szCollectionObj.Count; i++)
        {
            BCObj            obj = _dataCtrl.szCollectionObj[i];
            BCCollectionInfo col = _dataCtrl.GetCollectionInfo(obj.ID);
            List <int>       szTemp;
            if (dicCollections.TryGetValue(col.groupID, out szTemp))
            {
                szTemp.Add(obj.ID);
            }
            else
            {
                szTemp = new List <int>();
                szTemp.Add(obj.ID);
                dicCollections.Add(col.groupID, szTemp);
            }
        }
        int  index    = 0;
        bool showTips = false;

        foreach (KeyValuePair <int, List <int> > kvp in dicCollections)
        {
            int [] ids = kvp.Value.ToArray();
            if (ids.Length >= 3)
            {
                int left   = _dataCtrl.GetCollectionOwnNum(ids[0]);
                int center = _dataCtrl.GetCollectionOwnNum(ids[1]);
                int right  = _dataCtrl.GetCollectionOwnNum(ids[2]);
                if (Mathf.Min(left, center, right) > 0)
                {
                    showTips = true;
                    break;
                }
            }
        }
        spItemComplet.ESetActive(showTips);
    }
    void freshWithThreeCollection(int id1, int id2, int id3, Color color)
    {
        mObjID1 = id1;
        mObjID2 = id2;
        mObjID3 = id3;

        spTitleBackground.color = color;
        WGDataController _dataCtrl = WGDataController.Instance;
        int numleft   = _dataCtrl.GetCollectionOwnNum(id1);
        int numMiddle = _dataCtrl.GetCollectionOwnNum(id2);
        int numRight  = _dataCtrl.GetCollectionOwnNum(id3);

        mCanSellNum = Mathf.Min(numleft, numMiddle, numRight);

        BCCollectionInfo bci = WGDataController.Instance.GetCollectionInfo(id1);

        labGroupName.text = bci.groupdes;
        labGroupNum.text  = mCanSellNum.ToString();

        CItemCollectionCellView leftCell = CItemCollectionCellView.CreateCollectionCellView();

        AddCell(leftCell.gameObject, goLeft);
        leftCell.freshWithCollectionID(id1, color);
        szItemColCell.Add(leftCell);

        CItemCollectionCellView middelCell = CItemCollectionCellView.CreateCollectionCellView();

        AddCell(middelCell.gameObject, goMiddel);
        middelCell.freshWithCollectionID(id2, color);
        szItemColCell.Add(middelCell);

        CItemCollectionCellView rightCell = CItemCollectionCellView.CreateCollectionCellView();

        AddCell(rightCell.gameObject, goRight);
        rightCell.freshWithCollectionID(id3, color);
        szItemColCell.Add(rightCell);
    }
    public void FreshUI()
    {
        WGDataController _dataCtrl = WGDataController.Instance;

        for (int i = 0; i < szItemColCell.Count; i++)
        {
            szItemColCell[i].refreshView();
        }
        int numleft   = _dataCtrl.GetCollectionOwnNum(mObjID1);
        int numMiddle = _dataCtrl.GetCollectionOwnNum(mObjID2);
        int numRight  = _dataCtrl.GetCollectionOwnNum(mObjID3);

        mCanSellNum = Mathf.Min(numleft, numMiddle, numRight);

        labGroupNum.text = mCanSellNum.ToString();
        if (mCanSellNum > 0)
        {
            spTip.gameObject.SetActive(true);
        }
        else
        {
            spTip.gameObject.SetActive(false);
        }
    }