示例#1
0
        private void show_eqp()
        {
            // Debug.LogError(OffLineExpProxy.getInstance().eqp.Count+"ssssssss");
            if (OffLineExpProxy.getInstance().eqp.Count <= 16)
            {
                contain.GetComponent <GridLayoutGroup>().constraint      = GridLayoutGroup.Constraint.FixedColumnCount;
                contain.GetComponent <GridLayoutGroup>().constraintCount = 8;
            }
            else
            {
                contain.GetComponent <GridLayoutGroup>().constraint      = GridLayoutGroup.Constraint.FixedRowCount;
                contain.GetComponent <GridLayoutGroup>().constraintCount = 2;
            }
            foreach (var d in OffLineExpProxy.getInstance().eqp)
            {
                GameObject objClone = GameObject.Instantiate(eqp_icon) as GameObject;
                objClone.SetActive(true);
                objClone.transform.SetParent(contain.transform, false);
                objClone.transform.FindChild("equp").GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_item_" + d.tpid);

                objClone.transform.FindChild("quality_bg/" + d.confdata.equip_level).gameObject.SetActive(true);
                BaseButton btn = new BaseButton(objClone.transform.FindChild("equp").transform);
                btn.onClick = delegate(GameObject goo)
                {
                    ArrayList      data1 = new ArrayList();
                    a3_BagItemData one   = d;
                    data1.Add(one);
                    data1.Add(equip_tip_type.Comon_tip);
                    InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_EQUIPTIP, data1);
                };
            }
            if (OffLineExpProxy.getInstance().eqp.Count < 16)//每页16个,不足16个补上格子。
            {
                for (int i = 0; i < 16 - OffLineExpProxy.getInstance().eqp.Count; i++)
                {
                    GameObject objClone = GameObject.Instantiate(eqp_icon) as GameObject;
                    objClone.SetActive(true);
                    objClone.transform.SetParent(contain.transform, false);
                    objClone.transform.FindChild("equp").gameObject.SetActive(false);
                }
            }
            else//奇数变为偶数并且补上格子
            {
                if (OffLineExpProxy.getInstance().eqp.Count % 2 != 0)
                {
                    GameObject objClone = GameObject.Instantiate(eqp_icon) as GameObject;
                    objClone.SetActive(true);
                    objClone.transform.SetParent(contain.transform, false);
                    objClone.transform.FindChild("equp").gameObject.SetActive(false);
                }
            }
            // contain.GetComponent<RectTransform>().anchoredPosition = new Vector2((eqp_icon.GetComponent<RectTransform>().sizeDelta.x) * Mathf.CeilToInt(OffLineExpProxy.getInstance().eqp.Count / 2.0f), 0);
            contain.GetComponent <RectTransform>().sizeDelta = new Vector2((eqp_icon.GetComponent <RectTransform>().sizeDelta.x + 2.5f) * Mathf.CeilToInt(OffLineExpProxy.getInstance().eqp.Count / 2.0f), (eqp_icon.GetComponent <RectTransform>().sizeDelta.x) * 2);
        }
示例#2
0
        public override void onClosed()
        {
            foreach (BaseButton bs in lBtn)
            {
                bs.removeAllListener();
            }
            base.onClosed();
            OffLineExpProxy.getInstance().removeEventListener(OffLineExpProxy.EVENT_OFFLINE_EXP_GET, doGetExp);

            offLineModel.OnOffLineTimeChange -= OnTitleChange;
            offLineModel.OnBaseExpChange     -= OnCostTextChange;
        }
示例#3
0
        public override void onShowed()
        {
            if (PlayerModel.getInstance().last_time == 0 && OffLineExpProxy.getInstance().eqp.Count == 0)
            {
                transform.FindChild("equp/image_con").gameObject.SetActive(true);
            }
            else
            {
                transform.FindChild("equp/image_con").gameObject.SetActive(false);
            }

            show_eqp();
            for (int i = 0; i < lBtn.Count; i++)
            {
                lBtn[i].addEvent();

                Text textExp = lBtn[i].transform.FindChild("Text_exp").GetComponent <Text>();
                if (offLineModel.ismaxlvl)
                {
                    textExp.text = ContMgr.getCont("off_line_exp") + 0;
                }
                else
                {
                    textExp.text = ContMgr.getCont("off_line_exp") + (offLineModel.BaseExp * (i + 1));
                }
            }
            base.onShowed();
            vip_getexp_btn();
            OffLineExpProxy.getInstance().addEventListener(OffLineExpProxy.EVENT_OFFLINE_EXP_GET, doGetExp);
            // OffLineExpProxy.getInstance().addEventListener(OffLineExpProxy.EVENT_OFFLINE_EXP_GET, doGetExp);

            OnCostTextChange();
            OnTitleChange();
            offLineModel.OnOffLineTimeChange += OnTitleChange;
            offLineModel.OnBaseExpChange     += OnCostTextChange;
        }
示例#4
0
        private void OnClickToGetExp(int type)
        {
            A3_VipModel vipModel = A3_VipModel.getInstance();


            if (!offLineModel.CanGetExp)
            {
                flytxt.instance.fly(ContMgr.getCont("off_line_empty"));
                InterfaceMgr.getInstance().close(InterfaceMgr.OFFLINEEXP);
                a3_expbar.instance.getGameObjectByPath("operator/LightTips/btnAuto_off_line_exp").SetActive(false);
                return;
            }
            offline_item.Clear();
            offline = true;
            switch (type)
            {
            case 1:

                if (fenjie.isOn == true)
                {
                    OffLineExpProxy.getInstance().sendType(1, true);
                }
                else
                {
                    OffLineExpProxy.getInstance().sendType(1, false);
                }
                currentType = 1;
                break;

            case 2:

                if (PlayerModel.getInstance().money < OffLineModel.getInstance().GetCost(2))
                {
                    flytxt.instance.fly(ContMgr.getCont("off_line_exp_money"));
                }
                else
                {
                    if (fenjie.isOn == true)
                    {
                        OffLineExpProxy.getInstance().sendType(2, true);
                    }
                    else
                    {
                        OffLineExpProxy.getInstance().sendType(2, false);
                    }
                }
                currentType = 2;
                break;

            case 3:
                if (PlayerModel.getInstance().gold < OffLineModel.getInstance().GetCost(3))
                {
                    flytxt.instance.fly(ContMgr.getCont("off_line_exp_gold"));
                }
                //else if (vipModel.Level < vip_lite(3))
                //    flytxt.instance.fly(ContMgr.getCont("off_line_exp_vip"));
                else
                {
                    if (fenjie.isOn == true)
                    {
                        OffLineExpProxy.getInstance().sendType(3, true);
                    }
                    else
                    {
                        OffLineExpProxy.getInstance().sendType(3, false);
                    }
                }
                currentType = 3;
                break;

            case 4:
                if (PlayerModel.getInstance().gold < OffLineModel.getInstance().GetCost(4))
                {
                    flytxt.instance.fly(ContMgr.getCont("off_line_exp_gold"));
                }
                //else if (vipModel.Level < vip_lite(4))
                //    flytxt.instance.fly(ContMgr.getCont("off_line_exp_vip"));
                else
                {
                    if (fenjie.isOn == true)
                    {
                        OffLineExpProxy.getInstance().sendType(4, true);
                    }
                    else
                    {
                        OffLineExpProxy.getInstance().sendType(4, false);
                    }
                }
                currentType = 4;
                break;

            default:
                break;
            }
        }
示例#5
0
        private void OnClick_left()
        {
            float xx   = eqp_icon.GetComponent <RectTransform>().sizeDelta.x;
            float y    = contain.GetComponent <RectTransform>().anchoredPosition.y;
            float x    = contain.GetComponent <RectTransform>().anchoredPosition.x;
            float r_po = (eqp_icon.GetComponent <RectTransform>().sizeDelta.x) * Mathf.CeilToInt(OffLineExpProxy.getInstance().eqp.Count / 4.0f);

            if (contain.GetComponent <RectTransform>().anchoredPosition.x >= r_po - eqp_icon.GetComponent <RectTransform>().sizeDelta.x * 4 - 10)
            {
                return;
            }
            contain.GetComponent <RectTransform>().anchoredPosition = new Vector2(x + xx * 8, y);
        }
示例#6
0
        private void OnClick_right()
        {
            float xx   = eqp_icon.GetComponent <RectTransform>().sizeDelta.x;
            float y    = contain.GetComponent <RectTransform>().anchoredPosition.y;
            float x    = contain.GetComponent <RectTransform>().anchoredPosition.x;
            float r_po = (eqp_icon.GetComponent <RectTransform>().sizeDelta.x) * Mathf.CeilToInt(OffLineExpProxy.getInstance().eqp.Count / 4.0f);
            //Debug.LogError(r_po+"ss"+ eqp_icon.GetComponent<RectTransform>().sizeDelta.x+"ss"+ (OffLineExpProxy.getInstance().eqp.Count));
            float ss = -(r_po - eqp_icon.GetComponent <RectTransform>().sizeDelta.x * 4) + 10;

            //Debug.LogError(ss);
            if (contain.GetComponent <RectTransform>().anchoredPosition.x <= ss)
            {
                return;
            }
            contain.GetComponent <RectTransform>().anchoredPosition = new Vector2(x - xx * 8, y);
        }