Example #1
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);
        }
        //所有坐骑配置config
        private void GetAllRideConfig()
        {
            List <SXML> xml = XMLMgr.instance.GetSXMLList("ride.mount");

            foreach (SXML x in xml)
            {
                RideConfigVo infos = new RideConfigVo();
                infos.conditionLst = new List <ConditionVO>();

                infos.id     = x.getInt("id");
                infos.desc   = x.getString("desc");
                infos.name   = x.getString("name");
                infos.avatar = x.getString("avatar");
                infos.icon   = x.getString("icon");

                int condition = x.getInt("condition");

                infos.condition = condition;

                if (condition != -1)   // 多 (单) 条件
                {
                    foreach (var _x in x.GetNodeList("unlock"))
                    {
                        ConditionVO vo = new ConditionVO();
                        vo.type      = _x.getUint("type");
                        vo.lvl       = _x.getUint("lvl");
                        vo.need_item = _x.getUint("need_item");
                        vo.need_num  = _x.getUint("need_num");
                        infos.conditionLst.Add(vo);
                    }
                }
                else
                {
                    List <SXML> conditionLst = x.GetNodeList("unlock");
                    if (conditionLst.Count > 0)
                    {
                        ConditionVO vo = new ConditionVO();
                        SXML        _x = conditionLst[0];
                        vo.type      = _x.getUint("type");
                        vo.lvl       = _x.getUint("lvl");
                        vo.need_item = _x.getUint("need_item");
                        vo.need_num  = _x.getUint("need_num");
                        infos.conditionLst.Add(vo);
                    }
                }

                AddMapping(infos.id, rideMapping, infos);
            }

            GetAllTransformConfigVo();
        }