示例#1
0
        public void OnParentTabHandle()
        {
            var mapping = A3_RideModel.getInstance().GetRideInfo().ridedressMapiping;

            if (mapping != null)
            {
                List <uint> removeLst = new List <uint>();

                foreach (var item in mapping)
                {
                    if (item.Value.isforever == false && NetClient.instance.CurServerTimeStamp > item.Value.limit)
                    {
                        removeLst.Add(item.Key);
                    }
                }

                for (int i = 0; i < removeLst.Count; i++)
                {
                    if (mapping.ContainsKey(removeLst[i]))
                    {
                        mapping.Remove(removeLst[i]);
                    }

                    //ChangeLimitState((int)removeLst[i]);
                }
            }

            SetRideModelInfo();
        }
示例#2
0
        private void SetBtnLockState(int id)
        {
            var rideInfo = A3_RideModel.getInstance().GetRideInfo();

            var mapping = rideInfo.ridedressMapiping;

            _btnLock.gameObject.SetActive(!mapping.ContainsKey((uint)id));

            _parentconditionGo.SetActive(!rideInfo.ridedressMapiping.ContainsKey(( uint )id));

            _titleGo.SetActive(!rideInfo.ridedressMapiping.ContainsKey(( uint )id));

            //if (rideInfo.ridedressMapiping.ContainsKey((uint)id))
            //{
            //    _textLimit.gameObject.SetActive(rideInfo.ridedressMapiping[(uint)id].limit > 0);

            //    DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));

            //    string st = dtStart.AddSeconds(rideInfo.ridedressMapiping[(uint)id].limit).ToString("yyyy-MM-dd");

            //    _textLimit.text = st;

            //}
            //else {

            //    _textLimit.gameObject.SetActive(false);

            //}  // 到期时间

            _btnChange.gameObject.SetActive(rideInfo.ridedressMapiping.ContainsKey(( uint )id) && rideInfo.dress != ( uint )id);

            currGo.transform.FindChild("Image_Lock").gameObject.SetActive(!mapping.ContainsKey(( uint )id));

            _textTips.gameObject.SetActive(rideInfo.ridedressMapiping.ContainsKey((uint)id) && rideInfo.dress == (uint)id);

            //_iconUp.gameObject.SetActive( rideInfo.ridedressMapiping.ContainsKey((uint)id) && rideInfo.dress == (uint)id );

            if (rideInfo.dress == (uint)id)
            {
                _iconUp.transform.SetParent(currGo.transform);
                _iconUp.transform.localPosition = Vector3.zero;
            }

            //xuan zhe zhuang tai  tu pian

            if (mapping.ContainsKey((uint)id))
            {
                _selectBg.transform.SetParent(currGo.transform);

                _selectBg.transform.SetSiblingIndex(1);
            }
            else
            {
                _selectBg.transform.SetParent(currGo.transform.FindChild("Image_Lock").transform);

                _selectBg.transform.SetSiblingIndex(0);
            }

            _selectBg.transform.localPosition = Vector3.zero;
        }
示例#3
0
        private void SetRideData(GameObject go, RideConfigVo vo)
        {
            Image icon = go.transform.FindChild("Image/icon").GetComponent <Image>();

            var image_Lock = go.transform.FindChild("Image/Image_Lock").gameObject;

            icon.sprite = GAMEAPI.ABUI_LoadSprite("icon_item_" + vo.icon);

            BaseButton btn = new BaseButton(go.transform.FindChild("Image"));

            btn.onClick = ItemBtnHandle;

            _btnLst.Add(btn);

            icon.transform.parent.gameObject.name = vo.id.ToString();

            go.SetActive(true);

            go.transform.SetParent(_parentitemGo.transform);

            go.transform.localScale = new Vector3(1, 1, 1);

            var rideInfo = A3_RideModel.getInstance().GetRideInfo();

            var mapping = rideInfo.ridedressMapiping;

            image_Lock.SetActive(!mapping.ContainsKey((uint)vo.id));

            if (_goMapping != null)
            {
                _goMapping[vo.id] = go;
            }
        }
示例#4
0
        private int GetErrCode(List <ConditionVO> lst)
        {
            for (int i = 0; i < lst.Count; i++)
            {
                var type = lst[i].type;

                if (type == 1)
                {
                    var currLvl = A3_RideModel.getInstance().GetRideInfo().lvl;

                    if (currLvl < lst[i].lvl)
                    {
                        return(-5706);
                    }
                }
                else
                {
                    var itemId  = lst[i].need_item;
                    var needNum = lst[i].need_num;
                    var haveNum = a3_BagModel.getInstance().getItemNumByTpid(itemId);

                    if (haveNum < needNum)
                    {
                        ArrayList data = new ArrayList();
                        data.Add(a3_BagModel.getInstance().getItemDataById(itemId));
                        data.Add(InterfaceMgr.RIDE_A3);
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMLACK, data);
                        return(-1104);
                    }
                }
            }

            return(0);
        }
示例#5
0
        private void SetConditionData(GameObject go, ConditionVO vo)
        {
            Text type  = go.transform.FindChild("Text_ConditionTitle").GetComponent <Text>();
            Text value = go.transform.FindChild("Text_Value").GetComponent <Text>();

            if (vo.type == 1)
            {
                type.text  = ContMgr.getCont("condition_type" + vo.type);
                value.text = A3_RideModel.getInstance().GetRideLvl() + "/" + vo.lvl.ToString();

                bool isGreen = A3_RideModel.getInstance().GetRideLvl() >= (int)vo.lvl;

                value.color = isGreen ? Color.green : Color.red;
            }
            else
            {
                type.text  = a3_BagModel.getInstance().getItemDataById(vo.need_item).item_name;
                value.text = a3_BagModel.getInstance().getItemNumByTpid(vo.need_item) + "/" + vo.need_num.ToString();

                bool isGreen = a3_BagModel.getInstance().getItemNumByTpid(vo.need_item) >= (int)vo.need_num;

                value.color = isGreen ? Color.green : Color.red;
            }

            go.SetActive(true);
            go.transform.SetParent(_parentconditionGo.transform);
        }
示例#6
0
        public void OnAddOnClick()
        {
            new BaseButton(this.transform.FindChild("help_btn")).onClick = (GameObject go) => {
                helpcon.SetActive(true);
            };
            new BaseButton(helpcon.transform.FindChild("close")).onClick = (GameObject go) => {
                helpcon.SetActive(false);
            };

            _btn.onClick = (go) =>
            {
                if (_btn.interactable == false)
                {
                    return;
                }

                if (needNum > haveNum)
                {
                    Globle.err_output(-1104);
                    ArrayList data = new ArrayList();
                    data.Add(a3_BagModel.getInstance().getItemDataById(A3_RideModel.getInstance().GetUpGradeGiftItemId()));
                    data.Add(InterfaceMgr.RIDE_A3);
                    InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMLACK, data);
                    return;
                }
                _btn.interactable = false;

                A3_RideProxy.getInstance().SendC2S(3, "type", (uint)defaulSelect + 1);
            };
        }
示例#7
0
        private void ItemBtnHandle(GameObject go)
        {
            if (currGo != null)
            {
                if (int.Parse(go.name) == int.Parse(currGo.name) || isLoading)
                {
                    return;
                }
            }

            isLoading = true;

            RideConfigVo vo = A3_RideModel.getInstance().GetValueByType <RideConfigVo>(int.Parse(go.name));

            BuildConditionItem(vo.conditionLst, _conditionGo);

            _textName.text = vo.name.ToString();

            currGo = go;

            if (ride_a3._instance != null)
            {
                ride_a3._instance.CreatRideAvatar(int.Parse(go.name));
            }

            SetBtnLockState(vo.id);
        }
        private void S2CHandle(Variant s2cData)
        {
            int res = s2cData["res"];;

            //Debug.LogError( "==============坐骑消息" +  s2cData.dump().ToString() );

            switch (res)
            {
            case ( int )S2Cenum.RIDE_INFO:  A3_RideModel.getInstance().SetRideInfoS2cData(s2cData);  break;

            case ( int )S2Cenum.RIDE_UPGRADE: A3_RideModel.getInstance().ChangeRideLvlS2cData(s2cData);

                dispatchEvent(GameEvent.Create(( int )S2Cenum.RIDE_UPGRADE, this, s2cData));

                break;

            case ( int )S2Cenum.RIDE_UPGRADEGIFT: A3_RideModel.getInstance().ChangRideGiftLvlS2cData(s2cData);

                dispatchEvent(GameEvent.Create(( int )S2Cenum.RIDE_UPGRADEGIFT, this, s2cData));

                break;

            case ( int )S2Cenum.RIDE_UPDOWN: A3_RideModel.getInstance().ChangeRideStateS2cData(s2cData);

                dispatchEvent(GameEvent.Create(( int )S2Cenum.RIDE_UPDOWN, this, s2cData));

                Debug.LogError(s2cData.getValue("mount")._uint == 0 ? "下坐骑" : "上坐骑");

                break;

            case ( int )S2Cenum.RIDE_CHANGE: A3_RideModel.getInstance().ChangeRideDressS2cData(s2cData);

                dispatchEvent(GameEvent.Create(( int )S2Cenum.RIDE_CHANGE, this, s2cData));

                if (s2cData.ContainsKey("lock_dress"))
                {
                    dispatchEvent(GameEvent.Create((int)S2Cenum.RIDE_LIMIT, this, s2cData));                                     // 限时过期
                }
                break;

            case ( int )S2Cenum.RIDE_ADD:    A3_RideModel.getInstance().AddRideDressS2cData(s2cData);

                dispatchEvent(GameEvent.Create(( int )S2Cenum.RIDE_ADD, this, s2cData));

                break;

            case ( int )S2Cenum.RIDE_GIFTPOINT: break;

            default:

                Globle.err_output(res);

                break;
            }
        }
示例#9
0
 void checkRideWakan()
 {
     if (A3_RideModel.getInstance().GetRideInfo().lvl < 5)
     {
         this.transform.FindChild("BtnContainer/wakan").gameObject.SetActive(false);
     }
     else
     {
         this.transform.FindChild("BtnContainer/wakan").gameObject.SetActive(true);
     }
 }
示例#10
0
        private void OnUpDressState(GameEvent _event)
        {
            var rideInfo = A3_RideModel.getInstance().GetRideInfo();

            _btnChange.gameObject.SetActive(rideInfo.ridedressMapiping.ContainsKey(( uint )int.Parse(currGo.name)) && rideInfo.dress != ( uint )int.Parse(currGo.name));
            //currGo.transform.FindChild( "Image_Lock" ).gameObject.SetActive( !rideInfo.ridedressMapiping.ContainsKey( ( uint ) int.Parse( currGo.name ) ) );
            //currGo.transform.FindChild("icon_up").gameObject.SetActive(rideInfo.ridedressMapiping.ContainsKey((uint)int.Parse(currGo.name)) && rideInfo.dress == (uint)int.Parse(currGo.name));
            _iconUp.transform.SetParent(currGo.transform);
            _iconUp.transform.localPosition = Vector3.zero;
            _textTips.gameObject.SetActive(rideInfo.ridedressMapiping.ContainsKey((uint)int.Parse(currGo.name)) && rideInfo.dress == (uint)int.Parse(currGo.name));
        }
示例#11
0
        public void OnParentTabHandle()
        {
            defaulSelect = -1;
            tab.setSelectedIndex(defaulSelect == -1 ? 0 : 0, true);

            var giftMapping = A3_RideModel.getInstance().GetRideInfo().giftMapping;

            for (int i = 0; i < _textMapping.Count; i++)
            {
                _textMapping[i + 1].text = "Lv." + giftMapping[( uint )i + 1].lvl;
            }
        }
示例#12
0
        public void OnParentTabHandle()
        {
            SetRideInfo();

            isShow = true;

            var id = A3_RideModel.getInstance().GetRideInfo().dress;

            if (ride_a3._instance != null)
            {
                ride_a3._instance.CreatRideAvatar(( int )id);
            }
        }
示例#13
0
 private void OnBtnFeedHandle(GameObject go)
 {
     if (haveNum >= num && isAutoState == false)
     {
         A3_RideProxy.getInstance().SendC2S(2, "num", 1);
     }
     else
     {
         Globle.err_output(-1104);
         ArrayList data1 = new ArrayList();
         data1.Add(a3_BagModel.getInstance().getItemDataById(A3_RideModel.getInstance().GetUpGradeRideItemId()));
         data1.Add(InterfaceMgr.RIDE_A3);
         InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMLACK, data1);
     }
 }
示例#14
0
        public void OnAddOnClick()
        {
            _btnLock.onClick = (go) => {
                int id = int.Parse(currGo.name);

                RideConfigVo vo = A3_RideModel.getInstance().GetValueByType <RideConfigVo>(id);

                int errCode = GetErrCode(vo.conditionLst);

                if (errCode < 0)
                {
                    Globle.err_output(errCode);

                    return;
                }

                if (vo.condition != -1)
                {
                    A3_RideProxy.getInstance().SendC2S((uint)id, 0);
                }
                else
                {
                    A3_RideProxy.getInstance().SendC2S(( uint )id, vo.conditionLst[0].type);
                }
            };

            _btnChange.onClick = (go) =>

            {
                A3_RideProxy.getInstance().SendC2S(5, "dress", ( uint )int.Parse(currGo.name));
            };

            new BaseButton(this.transform.FindChild("help_btn")).onClick = (GameObject go) => {
                helpcon.SetActive(true);
            };
            new BaseButton(helpcon.transform.FindChild("close")).onClick = (GameObject go) => {
                helpcon.SetActive(false);
            };
        }
示例#15
0
        public RideInfo(Transform trans) : base(trans)
        {
            _attItem     = this.getGameObjectByPath("att_temp");
            _textLvl     = this.getGameObjectByPath("lvl").GetComponent <Text>();
            _rideName    = this.getGameObjectByPath("rideName").GetComponent <Text>();
            _feedNeedNum = this.getGameObjectByPath("con_stage/text").GetComponent <Text>();
            //_itemNum = this.getGameObjectByPath( "con_stage/Num" ).GetComponent<Text>();
            _slider     = this.getGameObjectByPath("con_stage/slider").GetComponent <Slider>();
            _feed       = new BaseButton(this.getTransformByPath("con_stage/improve"));
            _autofeed   = new BaseButton(this.getTransformByPath("con_stage/improve_auto"));
            _parentGo   = this.getGameObjectByPath("att/grid");
            _constageGo = this.getGameObjectByPath("con_stage");
            _textSpeed  = this.getComponentByPath <Text>("Text");

            helpcon = this.transform.FindChild("help").gameObject;
            helpcon.SetActive(false);


            a3_ItemData itmeVo = a3_BagModel.getInstance().getItemDataById(A3_RideModel.getInstance().GetUpGradeRideItemId());

            this.getTransformByPath("con_stage/icon").GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite(itmeVo.file);
        }
示例#16
0
        private void SetRideGiftData(uint type)
        {
            var giftVo = A3_RideModel.getInstance().GetRideInfo().giftMapping[type];

            _ridename.text = ContMgr.getCont("gift_type" + type);
            _lvl.text      = giftVo.lvl.ToString();

            if (_golst == null)
            {
                _golst     = new List <GameObject>();
                _nextgolst = new List <GameObject>();
            }

            RideGiftConfigVo configVo = A3_RideModel.getInstance().GetValueByType <RideGiftConfigVo>((int)giftVo.lvl);

            needNum = configVo.num;

            _needNumText.text = configVo.num.ToString();

            var id = A3_RideModel.getInstance().GetUpGradeGiftItemId();

            haveNum = a3_BagModel.getInstance().getItemNumByTpid(id);

            _haveNumText.text = haveNum.ToString();

            BuildGo(configVo.attMaping[(int)type], _golst, _parentGo);

            _nextContainer.SetActive(configVo.num != -1);

            _btnContainer.gameObject.SetActive(configVo.num != -1);

            if (configVo.num != -1)    //满了 -1
            {
                configVo = A3_RideModel.getInstance().GetValueByType <RideGiftConfigVo>(( int )giftVo.lvl + 1);

                BuildGo(configVo.attMaping[( int )type], _nextgolst, _parentNextGo);
            }
        }
示例#17
0
        private void SetRideModelInfo()
        {
            var rideInfo = A3_RideModel.getInstance().GetRideInfo();

            _textLvl.text  = rideInfo.lvl.ToString();
            _textName.text = rideInfo.configVo.name.ToString();

            if (_golst == null)
            {
                _golst     = new  List <GameObject>();
                _btnLst    = new List <BaseButton>();
                _goMapping = new Dictionary <int, GameObject>();

                BuildItem(A3_RideModel.getInstance().GetAllRideMapping(), _itemGo);
            }

            if (_btnLst.Count > 0)
            {
                var _currGo = GetCurrGameObject(( int )rideInfo.dress);

                ItemBtnHandle(_currGo == null  ? _btnLst[0].gameObject : _currGo);
            }
        }
示例#18
0
        private void OnBtnAutoFeedHandle(GameObject go)
        {
            if (haveNum > 0 && isAutoState == false)
            {
                isAutoState = true;

                var rideModel = A3_RideModel.getInstance();

                float maxCount = ((float)rideModel.maxExp - ( float )rideModel.GetRideInfo().exp) / (float)A3_RideModel.getInstance().eachExp;

                uint s2cCount = (uint)Math.Ceiling(maxCount);

                A3_RideProxy.getInstance().SendC2S(2, "num", s2cCount > (uint)haveNum ? ( uint )haveNum : s2cCount);
            }
            else
            {
                Globle.err_output(-1104);
                ArrayList data1 = new ArrayList();
                data1.Add(a3_BagModel.getInstance().getItemDataById(A3_RideModel.getInstance().GetUpGradeRideItemId()));
                data1.Add(InterfaceMgr.RIDE_A3);
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMLACK, data1);
            }
        }
示例#19
0
        private void SetRideInfo()
        {
            if (_gridGoLst == null)
            {
                _gridGoLst = new List <GameObject>();
            }

            var rideInfo = A3_RideModel.getInstance().GetRideInfo();

            _textLvl.text = rideInfo.lvl + "";

            _rideName.text = rideInfo.configVo.name;

            StringBuilder str = new StringBuilder(ContMgr.getCont("ride_speed"));

            _textSpeed.text = str.Append(rideInfo.lvlconfigVo.speed.ToString()).Append("%").ToString();

            var itemId = A3_RideModel.getInstance().GetUpGradeRideItemId();

            haveNum = a3_BagModel.getInstance().getItemNumByTpid(itemId);

            _feedNeedNum.text = haveNum + "/" + num.ToString();

            //_itemNum.text =haveNum.ToString();

            if (rideInfo.lvlconfigVo.attMappingLst.ContainsKey(PlayerModel.getInstance().profession))
            {
                SetGrid(rideInfo.lvlconfigVo.attMappingLst[PlayerModel.getInstance().profession], _attItem);
            }

            if (rideInfo.lvlconfigVo.exp != -1)
            {
                SetSliderValue(rideInfo.exp, ( uint )rideInfo.lvlconfigVo.exp);
            }

            _constageGo.SetActive(rideInfo.lvlconfigVo.exp == -1 ? false : true);
        }
示例#20
0
        public RideWakan(Transform trans) : base(trans)

        {
            _parentGo     = getGameObjectByPath("currWakanAtt/att/grid");
            _parentNextGo = getGameObjectByPath("NextWakanAtt/att/grid");
            itemGo        = getGameObjectByPath("att_temp");
            _lvl          = getComponentByPath <Text>("lvl");
            _ridename     = getComponentByPath <Text>("rideName");
            _haveNumText  = getComponentByPath <Text>("con_stage/Num");
            _needNumText  = getComponentByPath <Text>("con_stage/improve/text");

            //_help = new BaseButton(getTransformByPath( "title/help" ) );
            _btn = new BaseButton(getTransformByPath("con_stage/improve"));

            _nextContainer = getGameObjectByPath("NextWakanAtt");

            _btnContainer = getGameObjectByPath("con_stage");

            _textMapping = new Dictionary <int, Text>();

            for (int i = 0; i < 5; i++)
            {
                Text _text = this.getComponentByPath <Text>("BtnContainer/Image" + (i + 1).ToString() + "/Text");

                _textMapping.Add(i + 1, _text);
            }

            tab = new TabControl();
            tab.onClickHanle = tabhandel;
            tab.create(this.getGameObjectByPath("BtnContainer"), this.gameObject, defaulSelect == -1 ? 0 : 0, 0, false);

            a3_ItemData itmeVo = a3_BagModel.getInstance().getItemDataById(A3_RideModel.getInstance().GetUpGradeGiftItemId());

            this.getTransformByPath("con_stage/improve/icon").GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite(itmeVo.file);
            helpcon = this.transform.FindChild("help").gameObject;
            helpcon.SetActive(false);
        }
示例#21
0
        public override void onShowed()
        {
            isShowCompelet = true;

            SetState(false, InterfaceMgr.STATE_FUNCTIONBAR);

            CreatAvatar();

            if (_instance == null)
            {
                var id = A3_RideModel.getInstance().GetRideInfo().dress;

                CreatRideAvatar((int)id);

                _instance = this;
            }

            if (tab == null)
            {
                SetTabControl();
            }

            else
            {
                tab.setSelectedIndex(defaulSelect == -1 ? 0 : 0, true);
            }

            rideInfo.OnAddEventListener();
            rideModel.OnAddEventListener();
            rideWakan.OnAddEventListener();

            _rideAvatarMapping = new Dictionary <string, GameObject>();
            checkRideWakan();
            UiEventCenter.getInstance().onWinOpen(uiName);
            base.onShowed();
        }
        public A3_RideProxy()
        {
            A3_RideModel.getInstance();

            this.addProxyListener(PKG_NAME.S2C_RIDE, S2CHandle);
        }
示例#23
0
        private void ChangeLimitState(int id)
        {
            if (int.Parse(currGo.name) == id)
            {
                SetBtnLockState(id);
            }
            else
            {
                //
            }

            if (_goMapping.ContainsKey(id))
            {
                _goMapping[id].transform.FindChild(id + "/Image_Lock").gameObject.SetActive(A3_RideModel.getInstance().GetRideInfo().ridedressMapiping.ContainsKey((uint)id));

                //限时到期
            }
        }