Ejemplo n.º 1
0
    private void buttonClick(ButtonScript obj, object args, int param1, int param2)
    {
        Baby b = null;

        b = GamePlayer.Instance.GetBabyInst(param1);
        if (b != null)
        {
            if (BankSystem.instance.IsBabyStorageFull())
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("cankuman"));
                return;
            }
            if (b.isForBattle_)
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("chuzhan"));
                return;
            }
            if (b.GetInst().isShow_)
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("showbaby"));
                return;
            }

            StorageBabyCell bCell = obj.GetComponentInParent <StorageBabyCell> ();
            sDouble = false;
            StartCoroutine(DelayOnesortClick(bCell));
        }
    }
Ejemplo n.º 2
0
    public void AddItems(List <Baby> Entitylist)
    {
        for (int i = 0; i < Entitylist.Count; i++)
        {
            GameObject o = GameObject.Instantiate(babyItem) as GameObject;
            o.SetActive(true);
            o.name             = o.name + i;
            o.transform.parent = babyGrid.transform;
            StorageBabyCell mbCell = o.GetComponent <StorageBabyCell>();
            mbCell.BabyMainData = Entitylist[i];
//			if(Entitylist[i].isForBattle_)
//			{
//				mbCell.chuzhanButton.gameObject.SetActive(true);
//				mbCell.chuzhanButton.isEnabled = false;
//				mbCell.daimingButton.gameObject.SetActive(false);
//				mbCell.daimingButton.isEnabled = false;
//			}else
//			{
//				mbCell.chuzhanButton.isEnabled = false;
//				mbCell.daimingButton.isEnabled = false;
//				mbCell.chuzhanButton.gameObject.SetActive(false);
//				mbCell.daimingButton.gameObject.SetActive(true);
//
//			}
            o.transform.localScale = new Vector3(1, 1, 1);
            UIManager.SetButtonEventHandler(o, EnumButtonEvent.OnClick, buttonClick, Entitylist[i].InstId, Entitylist[i].GetIprop(PropertyType.PT_AssetId));
            UIEventListener.Get(o).onDoubleClick = OnCellDoubleToSortClick;
            GlobalInstanceFunction.Instance.Invoke(() => {
                babyGrid.Reposition();
            }, 1);
        }
    }
Ejemplo n.º 3
0
    private void UpdataTabCangItems()
    {
        RemoveStorageItemAllEventHandler();
        int num = _selsctCTabNum * 6;

        for (int i = 0; i < 6; i++)
        {
            StorageBabyCell bagCell = BabyCells[i].GetComponent <StorageBabyCell>();
            bagCell.BabyInst = GamePlayer.Instance.Storagebaby[num + i];

//			if(GamePlayer.Instance.Storagebaby[num+i] != null)
//			{
            UIManager.SetButtonEventHandler(BabyCells [i], EnumButtonEvent.OnClick, OnClickCell, 0, 0);
//			}

            int storNum = BankSystem.instance.babyNum;
            if (num + i >= storNum)          //已开启背包格子数.
            {
                BabyCells[i].GetComponent <StorageBabyCell>().Lock = false;
                UIManager.SetButtonParam(BabyCells [i].gameObject, 1, 0);
            }
            else
            {
                BabyCells[i].GetComponent <StorageBabyCell>().Lock = true;
                if (GamePlayer.Instance.Storagebaby[num + i] != null)
                {
                    UIManager.SetButtonParam(BabyCells [i].gameObject, 0, 0);
                }
                else
                {
                    UIManager.SetButtonParam(BabyCells [i].gameObject, 2, 0);
                }
            }
        }
    }
Ejemplo n.º 4
0
 void ShowStorageItem()
 {
     for (int i = 0; i < BabyCells.Length; i++)
     {
         GameObject obj = Object.Instantiate(cItem) as GameObject;
         obj.SetActive(true);
         obj.name = "agCell";
         cGrid.AddChild(obj.transform);
         StorageBabyCell sbcell = obj.GetComponent <StorageBabyCell>();
         sbcell.numsp.spriteName  = "";
         BabyCells[i]             = obj;
         obj.transform.localScale = Vector3.one;
     }
 }
Ejemplo n.º 5
0
 private void OnClickCell(ButtonScript obj, object args, int param1, int param2)
 {
     if (param1 == 2)
     {
         return;
     }
     if (param1 == 1)
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("shoulian"));
     }
     else
     {
         bDouble = false;
         StorageBabyCell bCell = obj.GetComponentInParent <StorageBabyCell> ();
         babyId = (int)bCell.BabyInst.instId_;
         StartCoroutine(DelayOneClick(bCell));
     }
 }
Ejemplo n.º 6
0
    void OnCellDoubleToSortClick(GameObject obj)
    {
        StorageBabyCell bCell = obj.GetComponentInParent <StorageBabyCell> ();

        if (BankSystem.instance.IsBabyStorageFull())
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("cankuman"));
            return;
        }
        if (bCell.BabyMainData.isForBattle_)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("chuzhan"));
            return;
        }
        if (bCell.BabyMainData.isShow_)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("showbaby"));
            return;
        }
        sDouble = true;
        StopCoroutine("DelayOnesortClick");


        if (bCell == null)
        {
            return;
        }


        BabyTipsUI bt = tipsObj.GetComponent <BabyTipsUI> ();

        bt.bcell = bCell;
        if (bCell.gameObject.name == "agCell")
        {
            bt.isbabyList = false;
        }
        else
        {
            bt.isbabyList = true;
        }
        UIManager.RemoveButtonAllEventHandler(obj);
        NetConnection.Instance.depositBabyToStorage((uint)bCell.BabyMainData.InstId);
    }
Ejemplo n.º 7
0
    IEnumerator DelayOnesortClick(StorageBabyCell bCell)
    {
        yield return(new WaitForSeconds(0.2f));

        if (!sDouble)
        {
            tipsObj.SetActive(true);
            BabyTipsUI btp = tipsObj.GetComponent <BabyTipsUI> ();
            if (bCell.gameObject.name == "agCell")
            {
                btp.isbabyList = false;
            }
            else
            {
                btp.isbabyList = true;
            }
            btp.baby  = bCell.BabyMainData;
            btp.bcell = bCell;
        }
    }
Ejemplo n.º 8
0
    void OnCellDoubleToBagClick(GameObject obj)
    {
        bDouble = true;
        StopCoroutine("DelayOneClick");
        COM_BabyInst _baby = obj.GetComponentInParent <StorageBabyCell> ().BabyInst;

        if (BankSystem.instance.IsBabyListFull())
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("EN_BabyFull"));
            return;
        }
        if (_baby == null)
        {
            return;
        }
        StorageBabyCell scell = obj.GetComponentInParent <StorageBabyCell> ();

        babyId = (int)scell.BabyInst.instId_;
        scell.icon.gameObject.SetActive(false);
        scell.raceIcon.gameObject.SetActive(false);
        BabyTipsUI bt = tipsObj.GetComponent <BabyTipsUI> ();

        if (scell.gameObject.name == "agCell")
        {
            bt.isbabyList = false;
        }
        else
        {
            bt.isbabyList = true;
        }
        bt.bcell = scell;
        bt.bcell.numsp.spriteName = "";
//		bt.bcell.iconBack.spriteName = "cw_chongwutouxiang1";
//		bt.bcell.iconBack.GetComponent<UIButton>().normalSprite = "cw_chongwutouxiang1";
        UIManager.RemoveButtonAllEventHandler(obj);
        NetConnection.Instance.storageBabyToPlayer(_baby.instId_);
    }
Ejemplo n.º 9
0
    IEnumerator DelayOneClick(StorageBabyCell bCell)
    {
        yield return(new WaitForSeconds(0.2f));

        if (!bDouble)
        {
            tipsObj.SetActive(true);
            COM_BabyInst binst = null;
            for (int i = 0; i < GamePlayer.Instance.Storagebaby.Length; i++)
            {
                if (GamePlayer.Instance.Storagebaby[i] == null)
                {
                    continue;
                }
                if (GamePlayer.Instance.Storagebaby[i].instId_ == bCell.BabyInst.instId_)
                {
                    binst = GamePlayer.Instance.Storagebaby[i];
                    break;
                }
            }
            Baby baby = new Baby();
            baby.SetBaby(binst);

            BabyTipsUI bt = tipsObj.GetComponent <BabyTipsUI> ();
            if (bCell.gameObject.name == "agCell")
            {
                bt.isbabyList = false;
            }
            else
            {
                bt.isbabyList = true;
            }
            bt.bcell = bCell;
            bt.baby  = baby;
        }
    }