Ejemplo n.º 1
0
    /// <summary>
    /// 高亮处理
    /// </summary>
    /// <param name="go">Go.</param>
    public void GoodsHightlightOnClick(GameObject go)
    {
        UIWidgetContainer item = go.GetComponent <UIWidgetContainer>();

        if (!item.Equals(lastWc))
        {
            UISprite hightlight = item.FindInChild <UISprite>("gaoguang");
            hightlight.gameObject.SetActive(true);
            if (lastWc != null)
            {
                lastWc.FindInChild <UISprite>("gaoguang").gameObject.SetActive(false);
            }
        }
    }
Ejemplo n.º 2
0
        private void InitSpriteHelp(UIWidgetContainer item, string path, UIAtlas atlas, string spriteName)
        {
            UISprite sprite = item.FindInChild <UISprite>(path);

            if (string.IsNullOrEmpty((spriteName)))
            {
                atlas = null;
            }
            if (sprite != null)
            {
                sprite.atlas      = atlas;
                sprite.spriteName = spriteName;
            }
        }
Ejemplo n.º 3
0
        private void InitSpriteHelp(UIWidgetContainer item, string path, string atlas, string spriteName)
        {
            UISprite sprite = item.FindInChild <UISprite>(path);

            if (string.IsNullOrEmpty((spriteName)))
            {
                atlas = null;
            }
            if (sprite != null)
            {
                sprite.atlas = Singleton <AtlasManager> .Instance.GetAtlas(atlas);

                sprite.spriteName = spriteName;
            }
        }
Ejemplo n.º 4
0
        protected override void Init()
        {
            //btn_back.
            btn_start = Tools.find(gameObject, "btn_start").GetComponent <UIWidgetContainer>();
            btn_start.FindInChild <UILabel>("label").text = LanguageManager.GetWord("RoleCreate.BtnStart");
            //btn_back = Tools.find(gameObject, "btn_fanhui").GetComponent<UIWidgetContainer>();
            btn_random  = Tools.find(gameObject, "btn_random").GetComponent <Button>();
            input       = Tools.find(gameObject, "inp_name").GetComponent <UIInput>();
            yuansushi   = Tools.find(gameObject, "ckb_yss").GetComponent <UIToggle>();
            mojianshi   = Tools.find(gameObject, "ckb_mjs").GetComponent <UIToggle>();
            qiangxieshi = Tools.find(gameObject, "ckb_qxs").GetComponent <UIToggle>();
            //yuansushiSprite = Tools.find(gameObject, "rw/yss").GetComponent<UI2DSprite>();
            //mojianshiSprite = Tools.find(gameObject, "rw/mjs").GetComponent<UI2DSprite>();
            //qiangxieshiSprite = Tools.find(gameObject, "rw/qxs").GetComponent<UI2DSprite>();

            //scale = FindInChild<TweenScale>("rw");
            //yssInfoSprite = FindInChild<UISprite>("info/yuansushi");
            //mjsInfoSprite = FindInChild<UISprite>("info/mojianshi");
            //qxsInfoSprite = FindInChild<UISprite>("info/qiangxieshi");
            tipsLabel       = FindInChild <UILabel>("info/shuoming");
            info            = FindChild("info").transform;
            info.localScale = Vector3.one;
            info.gameObject.SetActive(true);

            modelSpin = NGUITools.FindInChild <SpinWithMouse>(gameObject, "mode");

            btn_random.onClick += RandomName;
            btn_start.onClick  += StartGame;
            //btn_back.onClick = BackOnClick;
            yuansushi.startsActive   = false;
            mojianshi.startsActive   = false;
            qiangxieshi.startsActive = false;
            //yuansushiSprite.gameObject.SetActive(false);
            //qiangxieshiSprite.gameObject.SetActive(false);
            //mojianshiSprite.gameObject.SetActive(false);
            yuansushi.onStateChange   += CheckBoxStateChange;
            mojianshi.onStateChange   += CheckBoxStateChange;
            qiangxieshi.onStateChange += CheckBoxStateChange;
            //input.onChange.Add(new EventDelegate(LimitNameShow));  //限制显示名字的长度
            input.characterLimit = 6; //限制最长为6个字符
            // LoadRandomNameData();
            gameObject.SetActive(false);
            NGUITools.SetLayer(gameObject, LayerMask.NameToLayer("Mode"));
            EffectMgr.Instance.CreateUIEffect(EffectId.UI_SelectRoleStage1, Vector3.zero, OnFirstEffectOver);
            // play = NGUITools.FindInChild<TweenPlay>(gameObject, "mode");
            FindInChild <UIWidgetContainer>("mode").onClick = OnRoleClick;
        }
Ejemplo n.º 5
0
        // 126 ,190 ,227
        protected override void HandleAfterOpenView()
        {
            if (showOtherPlayerEquip)
            {
                SetViewForOtherPlayer();
            }

            SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId);

            fightpoint.text = string.Empty + GoodsMode.Instance.CalculateFightPoint(goods);
            Singleton <ItemManager> .Instance.InitItem(goodsIcon, goods.goodsId, 0);

            List <PSuitAttr> suitAttr = new List <PSuitAttr>();

            if (vo != null)            //装备描
            {
                itemName.text = ColorUtils.GetEquipColor(vo.color, vo.name);
                jobLabel.text = LanguageManager.GetWord("Role.TipsJob" + vo.job);
                string lvl    = StringUtils.SplitVoString(vo.lvl)[0];
                int    refine = (goods.equip.Count == 0)? 0 : (int)(goods.equip[0].refine);
                int    stren  = (goods.equip.Count == 0) ? 0 : (int)(goods.equip[0].stren);
                suitAttr = goods.equip.Count == 0?null: goods.equip[0].suitList;
                goodsIcon.FindInChild <UILabel>("stren").text = "+" + stren;

                UILabel label;
                string  suitStr = null;
                for (int i = 0; i < 5; i++)
                {
                    label = fjList[i];
                    if (suitAttr != null && i < suitAttr.Count)
                    {
                        suitStr = string.Format(LanguageManager.GetWord("Language.Format1"),
                                                LanguageManager.GetWord("Role.Attr" + suitAttr[i].id), suitAttr[i].attr) +
                                  VoUtils.LanguagerFormat("EquipTips.SuitStar", suitAttr[i].pos);
                        label.text = ColorUtils.GetEquipColor(3, suitStr);   //已经开启使用蓝色
                    }
                    else
                    {
                        suitStr    = VoUtils.GetColorTips(i + 1);
                        label.text = ColorUtils.GetEquipColor(i + 2, suitStr);
                    }
                }
                for (int i = 0; i < 15; i++)
                {
                    if (refine <= i)
                    {
                        refineList[i].spriteName = "kongxing";
                    }
                    else
                    {
                        refineList[i].spriteName = "xingxing1";
                    }
                }

                string[]      strenType = StringUtils.SplitVoString(vo.stren_type);
                List <string> strs      = new List <string>();
                foreach (string s in strenType)
                {
                    strs.AddRange(StringUtils.GetValueListFromString(vo.GetEquipStrenType(int.Parse(s))));
                }
                int         type;
                SysRefineVo refineVo;
                //基础属性计算
                for (int i = 0; i < 2; i++)
                {
                    if (i < strenType.Length)
                    {
                        type = int.Parse(strenType[i]);

                        int addValue   = int.Parse(strs[i * 2 + 1]);
                        int strenValue = int.Parse(strs[i * 2]) + addValue * stren;
                        refineVo = BaseDataMgr.instance.GetDataById <SysRefineVo>((uint)refine);

                        float  rate      = refineVo.GetRefineRate();
                        int    addValue1 = Mathf.RoundToInt(strenValue * rate);
                        string format    = LanguageManager.GetWord("Language.Format4");
                        string key       = VoUtils.GetRoleAttr(type); //属性文本
                        if (addValue1 == 0)                           //没有精炼加成值
                        {
                            format = LanguageManager.GetWord("Language.Format1");
                            if (type != 10 && type != 8)   //不是物攻和魔攻
                            {
                                jcList[i].text = string.Format(format, key, strenValue);
                            }
                            else
                            {
                                string minValue = vo.GetEquipStrenType(type - 1);
                                jcList[i].text = string.Format(format, string.Format(ColorConst.EQUIP_BLUE_FORMAT, key), minValue + "-" + strenValue);
                            }
                        }
                        else
                        {
                            if (type != 10 && type != 8)
                            {
                                jcList[i].text = string.Format(format, string.Format(ColorConst.EQUIP_BLUE_FORMAT, key), strenValue, string.Format(ColorConst.GREEN_FORMAT, "+" + addValue1 + "( " +
                                                                                                                                                   string.Format("{0:0%}", rate) + " )"));
                            }
                            else
                            {
                                string minValue = vo.GetEquipStrenType(type - 1);
                                jcList[i].text = string.Format(format, string.Format(ColorConst.EQUIP_BLUE_FORMAT, key), minValue + "-" + strenValue, string.Format(ColorConst.GREEN_FORMAT, "+" + addValue1 + "( " +
                                                                                                                                                                    string.Format("{0:0%}", rate) + " )"));
                            }
                        }
                    }
                    else
                    {
                        jcList[i].text = string.Empty;
                    }
                }
                int repos = Singleton <GoodsMode> .Instance.GetReposById(goods.id);

                string lvlString = MeVo.instance.Level < vo.GetLvl() ? string.Format(ColorConst.RED_FORMAT, lvl):lvl + string.Empty;
                if (repos == GoodsMode.Instance.GOODS_REPOS)
                {
                    itemLevel.text = "等级: " + lvlString + " (未装备)";
                }
                else if (repos == GoodsMode.Instance.EQUIP_REPOS)
                {
                    itemLevel.text = "等级: " + lvlString + " (已装备)";
                }
                else
                {
                    itemLevel.text = "等级: " + lvlString;
                }

                PEquip            equip = (goods.equip.Count == 0) ? new PEquip() : goods.equip[0];
                int               count = equip.gemList.Count;
                UIWidgetContainer ic;
                PGemInHole        gem;
                SysItemVo         smeltVo;
                for (int i = 0; i < 5; i++)               //宝石镶嵌信息
                {
                    ic = smeltList[i];
                    UILabel label1 = ic.FindInChild <UILabel>("label");
                    if (i < count)               //已经镶嵌
                    {
                        gem = equip.gemList[i];
                        ItemManager.Instance.InitItem(ic, gem.gemId, 0);
                        smeltVo      = BaseDataMgr.instance.GetDataById <SysItemVo>(gem.gemId);
                        label1.text  = VoUtils.GetRoleAttr(smeltVo.subtype) + ": +" + smeltVo.value;
                        label1.color = Color.green;
                    }
                    else
                    {
                        List <PGoods> goodsList = GoodsMode.Instance.GetSmeltGemListByGoodsId(this.goods.goodsId);
                        if (goodsList.Count != 0)
                        {
                            ItemManager.Instance.InitItem(ic, ItemManager.Instance.ADD_ICON, 0);

                            label1.text = "可镶嵌";
                        }
                        else
                        {
                            ItemManager.Instance.InitItem(ic, ItemManager.Instance.EMPTY_ICON, 0);
                            label1.text = "未镶嵌";
                        }
                        label1.color = new Color(169 / 255f, 169 / 255f, 169 / 255f);
                    }
                }
            }

            //按钮回调和位置调整
            btn_right.FindInChild <UILabel>("label").text = rightBtnLabel; //文本显示
            btn_left.FindInChild <UILabel>("label").text  = leftBtnLabel;
            btn_left.clickDelegate = mLeftOnClick;                         //响应事件指定
            bool isCenter = false;

            if (mLeftOnClick == null)
            {
                btn_left.SetActive(false);
                isCenter = true;
            }
            else
            {
                btn_left.SetActive(true);
                if (tipsType != TipsType.DELEGATENOCLOSE)
                {
                    btn_left.clickDelegate += CloseView;
                }
            }
            btn_right.clickDelegate = mRightOnClick;

            if (mRightOnClick == null)
            {
                btn_right.SetActive(false);
                isCenter = true;
            }
            else
            {
                btn_right.SetActive(true);
                if (tipsType != TipsType.DELEGATENOCLOSE)
                {
                    btn_right.clickDelegate += CloseView;
                }
            }
            if (isCenter)          //调整位置
            {
                btn_left.transform.localPosition = new Vector3(-3f, -238f, 0f);
                btn_left.FindInChild <UISprite>("background").width = 280;
                btn_left.FindInChild <UISprite>("highlight").width  = 298;
                btn_right.transform.localPosition = new Vector3(-3f, -238f, 0f);
                btn_right.FindInChild <UISprite>("background").width = 280;
                btn_right.FindInChild <UISprite>("highlight").width  = 298;
            }
            else
            {
                btn_left.transform.localPosition = new Vector3(-98.5f, -238f, 0f);
                btn_left.FindInChild <UISprite>("background").width = 167;
                btn_left.FindInChild <UISprite>("highlight").width  = 179;
                btn_right.transform.localPosition = new Vector3(78.5f, -238f, 0f);
                btn_right.FindInChild <UISprite>("background").width = 167;
                btn_right.FindInChild <UISprite>("highlight").width  = 179;
            }
            if (mOpenHandle != null)
            {
                mOpenHandle();
            }
            setEquipTipsPlayReverse();
        }