Exemple #1
0
 public void ItemSort()
 {
     itemList.Sort((Item item1, Item item2) =>
     {
         ItemConfig ic1 = JsonMgr.GetSingleton().GetItemConfigByID(item1.itemId);
         ItemConfig ic2 = JsonMgr.GetSingleton().GetItemConfigByID(item2.itemId);
         //道具物品类型不同时
         if (ic1.type < ic2.type)
         {
             return(-1);   //左值小于右值,返回-1,为升序,如果返回1,就是降序
         }
         else if (ic1.type > ic2.type)
         {
             return(1);
         }
         else
         {
             //道具物品类型相同时,则按物品的稀有度进行排序
             if (ic1.rare < ic2.rare)
             {
                 return(1);
             }
             else if (ic1.rare > ic2.rare)
             {
                 return(-1);
             }
             else if (ic1.rare == ic2.rare)
             {
                 if (ic1.ID < ic2.ID)
                 {
                     return(1);
                 }
                 else if (ic1.ID > ic2.ID)
                 {
                     return(-1);
                 }
                 else
                 {
                     return(0);
                 }
             }
             else
             {
                 return(0);
             }
         }
     });
 }
    private void SetHeadView()
    {
        HeroRare officerUp = JsonMgr.GetSingleton().GetHeroRareByID(heroData.Rare);

        Border_img.sprite = ResourceMgr.Instance.LoadSprite(officerUp.HeadBorder);
        Head_img.sprite   = ResourceMgr.Instance.LoadSprite(heroData.JsonData.headid);
        Lv_txt.text       = heroData.Level.ToString();

        int showStar = HeroMgr.MaxHeroStar - heroData.Star;

        starImage = HideStar_obj.transform.GetComponentsInChildren <Transform>();
        for (int i = 0; i < showStar; ++i)
        {
            starImage[i].SetParent(StarParent_obj.transform);
        }
    }
 public void UpdateHero()
 {
     HeadSort();
     for (int i = 0; i < heros.Count; i++)
     {
         if (herolist[i].isHave == 1)
         {
             heros[i].nothave_obj.SetActive(false);
         }
         else
         {
             heros[i].nothave_obj.SetActive(true);
         }
         heros[i].SetHeroHaveInfo(JsonMgr.GetSingleton().GetHeroByID(herolist[i]._heros.ID));
     }
 }
    private void SetStrengthenView()
    {
        StringBuilder sb     = new StringBuilder();
        StringBuilder nextSB = new StringBuilder();

        Pro[] p = equip.Attribute;
        for (int i = 0, length = p.Length; i < length; ++i)
        {
            sb.Append(AttrUtil.GetAttribute(p[i].attr));
            nextSB.Append(AttrUtil.GetAttribute(p[i].attr));
            sb.Append(": +");
            nextSB.Append(": +");
            sb.Append(AttrUtil.ShowText(p[i].attr, equip.JsonData.Attribute[i].num + p[i].num, equip.JsonData.Attribute[i].per + p[i].per));
            nextSB.Append(AttrUtil.ShowText(p[i].attr, equip.JsonData.Attribute[i].num * 2 + p[i].num, equip.JsonData.Attribute[i].per * 2 + p[i].per));
            sb.Append("\n");
            nextSB.Append("\n");
        }
        attr_txt.supportRichText = true;
        string title = equip.ItemData.name + (equip.StrengthenLv == 0 ? "" : " +" + equip.StrengthenLv) + "\n";

        title             = title.AddColorLabel(ColorMgr.Colors[equip.ItemData.rare - 1]);
        attr_txt.text     = title + sb;
        title             = equip.ItemData.name + " +" + (equip.StrengthenLv + 1) + "\n";
        title             = title.AddColorLabel(ColorMgr.Colors[equip.ItemData.rare - 1]);
        thenattr_txt.text = title + nextSB;
        sb     = null;
        nextSB = null;

        equip_img.sprite      = thenequip_img.sprite = ResourceMgr.Instance.LoadSprite(equip.ItemData.icon);
        thenborder_img.sprite = border_img.sprite = ResourceMgr.Instance.LoadSprite(ColorMgr.Border[equip.ItemData.rare - 1]);
        lvfloor_cr.SetAlpha(equip.StrengthenLv);
        lv_txt.text = equip.StrengthenLv == 0 ? "" : "+" + equip.StrengthenLv;
        thenlvfloor_cr.SetAlpha(1);
        thenlv_txt.text = "+" + (equip.StrengthenLv + 1);
        EventListener.Get(strengthen_btn.gameObject).OnClick = e =>
        {
            if (EquipMgr.GetSingleton().UpEquip(equip))
            {
                StrengthenOK_img.GetComponent <UISprite>().Play();
            }
            SetStrengthenView();
        };
        EventListener.Get(strengthenonekey_btn.gameObject).OnClick = e =>
        {
        };
        spend_txt.text = JsonMgr.GetSingleton().GetStrengthenSpendByID(equip.StrengthenLv).spend.ToString();
    }
Exemple #5
0
    /// <summary>
    /// 打开一个UI
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    protected UIConfig OpenUI(UIID id)
    {
        IUICtrl  ctrl   = _register[id];
        UIConfig uiJson = JsonMgr.GetSingleton().GetUIConfigByID((int)id);

        if (uiJson == null)
        {
            return(null);
        }
        UIViewBase vb = ctrl.GetView();

        if (vb == null)
        {
            GameObject uigo = GameObject.Instantiate(ResourceMgr.Instance.LoadResource(uiJson.Resid) as GameObject);
            if (uigo == null)
            {
                throw new System.Exception("加载UI资源出错 -------- " + uiJson.Resid);
            }
            vb = uigo.GetComponent <UIViewBase>();

            ctrl.SetView(vb);
            ctrl.OnInit();
            vb.AddComponent(uiJson);
        }
        vb.SetOrder(++layerOrder[uiJson.Layer]);

        if (!ctrl.IsOpen())
        {
            vb.SetView(true);
            ctrl.OnOpen();
        }
        if (!openList.Contains(id))
        {
            if ((uiJson.Layer.Equals("UI1") || uiJson.Layer.Equals("Default")))
            {
                Debug.LogFormat("Add into OpenList {0}", id);
                openList.Add(id);
            }
        }
        else
        {
            //换到队尾
            openList.Remove(id);
            openList.Add(id);
        }
        return(uiJson);
    }
Exemple #6
0
    /// <summary>
    /// 加载音乐、音效
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public AudioClip LoadSound(int id)
    {
        var jResObj = JsonMgr.GetSingleton().GetSoundArrayByID(id);

        if (jResObj == null)
        {
            return(null);
        }
#if USE_ASSETBUNDLE
        //音效和资源不同,音效的AssetBundle中包含多个资源,每一个是以资源名命名的,所以这里用ResourcePath
        string resName = jResObj.ResourcePath.ToString();
        if (_allAudioClip.ContainsKey(resName))
        {
            return(_allAudioClip[resName]);
        }
        else
        {
            string assetBundleName = jResObj.ResourceName.ToString();
            if (!_allAssetBundles.ContainsKey(assetBundleName))
            {
                Debug.LogErrorFormat("Load Resource {0} failed, assetbundle {1} not loaded", resName, assetBundleName);
                return(null);
            }
            AssetBundle bundle     = _allAssetBundles[assetBundleName];
            AudioClip[] audioClips = bundle.LoadAllAssets <AudioClip>();
            for (int idx = 0; idx < audioClips.Length; ++idx)
            {
                _allAudioClip.Add(audioClips[idx].name, audioClips[idx]);
            }
            if (!_allAudioClip.ContainsKey(resName))
            {
                Debug.LogErrorFormat("Load Resource {0} failed, assetbundle {1} loaded but no such res", resName, assetBundleName);
                return(null);
            }
            return(_allAudioClip[resName]);
        }
#else
        string path = "Sound/" + jResObj.ResourcePath.ToString();
        Object obj  = Resources.Load(path);
        if (obj == null)
        {
            Debug.LogFormat("Load Resource failed,invalid path:{0}", path);
            return(null);
        }
        return((obj as GameObject).GetComponent <AudioSource>().clip);
#endif
    }
    private void SetSpendView(AdvancedSpend aspend)
    {
        int   share = aspend.material.Length - 1;
        float angle = 360f / share;

        for (int i = 0; i < aspend.material.Length - 1; ++i)
        {
            GameObject mGo    = Instantiate(material, parent_trf);
            float      radian = -(angle / 180) * Mathf.PI * i;
            mGo.transform.localPosition = new Vector3(Mathf.Sin(radian) * distance, Mathf.Cos(radian) * distance, 0);
            MateralItem mi = mGo.GetComponent <MateralItem>();
            mi.SetView(aspend.material[i]);
        }
        advancedspend_txt.text    = aspend.material[share].num.ToString();
        advancedequip_img.sprite  = ResourceMgr.Instance.LoadSprite(JsonMgr.GetSingleton().GetItemConfigByID(aspend.ID).icon);
        advancedborder_img.sprite = ResourceMgr.Instance.LoadSprite(ColorMgr.Border[equip.ItemData.rare]);
    }
    /// <summary>
    /// 初始化单个物品
    /// </summary>
    /// <param name="items"></param>
    public void SetItemInfo(int itemid, int itemnum)
    {
        this.itemid = itemid;
        ItemConfig ic = JsonMgr.GetSingleton().GetItemConfigByID(itemid);

        itemlevel_img.sprite = ResourceMgr.Instance.LoadSprite(ColorMgr.Border[ic.rare - 1]);
        item_img.sprite      = ResourceMgr.Instance.LoadSprite(ic.icon);
        if (itemnum == 1)
        {
            itemnum_txt.text = "";
        }
        else
        {
            itemnum_txt.text = itemnum.ToString();
        }
        itemname_txt.text = JsonMgr.GetSingleton().GetItemConfigByID(itemid).name;
    }
Exemple #9
0
    public Object LoadResource(int id)
    {
        var jRes = JsonMgr.GetSingleton().GetResArrayByID(id);

        if (jRes == null)
        {
            Debug.LogErrorFormat("LoadResource failed, no such resid:{0}", id);
            return(null);
        }
#if USE_ASSETBUNDLE
        string assetBundleName = jRes.ResourceName.ToString();
        if (_allRes.ContainsKey(assetBundleName))
        {
            return(_allRes[assetBundleName]);
        }
        AssetBundle bundle = _loadAssetBundle(assetBundleName);
        if (bundle == null)
        {
            Debug.LogErrorFormat("No AssetBundle Names:{0}. Please check res json or StreammingAssets");
            return(null);
        }
        string path     = jRes.ResourcePath.ToString();
        string fileName = PathUtil.GetName(path);
        Object obj      = bundle.LoadAsset(fileName);
        if (obj == null)
        {
            Debug.LogErrorFormat("AssetBundle.LoadAsset failed, no name:{0}. ", fileName);
            return(null);
        }
        FixShader(obj as GameObject);
        _allRes[assetBundleName] = obj;
        return(obj);
#else
        string path = jRes.ResourcePath.ToString();
        Object res  = Resources.Load(path);
        if (res == null)
        {
            Debug.LogErrorFormat("Load Resource {0} failed, error path:", path);
            return(null);
        }
        else
        {
            return(res);
        }
#endif
    }
Exemple #10
0
    private HeroMgr()
    {
        _heroData   = new Dictionary <int, HeroData>();
        takeOfficer = new Dictionary <int, int>();
        //调用获取数据 以后由服务器调用
        HeroDataLoaded();
        MaxHeroStar  = (int)JsonMgr.GetSingleton().GetGlobalIntArrayByID(1019).value;
        MaxHeroLevel = (int)JsonMgr.GetSingleton().GetGlobalIntArrayByID(1022).value;

        string unlock = JsonMgr.GetSingleton().GetGlobalStringArrayByID(10001).desc;

        string[] temp = unlock.Split('#');
        unLockLv = new int[temp.Length];
        for (int i = 0; i < unLockLv.Length; ++i)
        {
            unLockLv[i] = int.Parse(temp[i]);
        }
    }
Exemple #11
0
 public void OnSelectPer()
 {
     if (this.mView.Import_input.text == "")
     {
         this.mView.Caution(this.mView.Shield1_img, true);
         Debug.Log("请输入名字");
         return;
     }
     if (JsonMgr.GetSingleton().ExamineShieldWord(this.mView.Import_input.text))
     {
         OnCreateRole(this.mView.Import_input.text, this.mView.isMan, (int)this.mView.role);
     }
     else
     {
         this.mView.Caution(this.mView.Shield_img, false);
         Debug.Log("包含屏蔽或特殊字符");
     }
 }
Exemple #12
0
    public void Init()
    {
        var jSprite = JsonMgr.GetSingleton().GetGameManagerArray();

        for (int i = 0; i < jSprite.Length; ++i)
        {
            GameObject gmbutto = InitItemInfo();
            Text       name    = gmbutto.GetComponentInChildren <Text>();
            var        command = jSprite[i];
            if (name.text.Length == 0)
            {
                Button gmbutt = gmbutto.GetComponent <Button>();
                gmbutt.onClick.AddListener(delegate() { this.GMorder(command.command); });
                name.text = command.desc;
                GmButtonList.Add(gmbutt);
            }
        }
    }
    public void OnFightUnitAddBuff(FightUnit unit, int resid, bool onfoot, bool addOrRemove)
    {
        if (unit != this.unit)
        {
            return;
        }
        if (addOrRemove)
        {
            int horseId = !unit.IsMonster ? JsonMgr.GetSingleton().GetHeroByID(unit.HeroId).horseid : JsonMgr.GetSingleton().GetMonsterByID(unit.HeroId).horseid;

            GameObject effect = EffectMgr.Instance.CreateEffect(this.unit, resid, new Vector3(0, onfoot ? 0 : (horseId != 0 ? 0.6f : -0.3f), 0), Quaternion.identity, true, this.transform);
            _checkFightUnitEffect(effect, -1);
        }
        else
        {
            EffectMgr.Instance.RemoveEffect(this.unit, resid);
        }
    }
Exemple #14
0
    public static void GetConfig()
    {
        string cString = JsonMgr.GetSingleton().GetGlobalStringArrayByID(10002).desc;
        string bString = JsonMgr.GetSingleton().GetGlobalStringArrayByID(10003).desc;

        string[] cArray = cString.Split('#');
        _colors = new string[cArray.Length];
        for (int i = 0; i < cArray.Length; ++i)
        {
            _colors[i] = cArray[i];
        }
        string[] bArray = bString.Split('#');
        Border = new int[bArray.Length];
        for (int i = 0; i < bArray.Length; ++i)
        {
            Border[i] = int.Parse(bArray[i]);
        }
    }
Exemple #15
0
    /// <summary>
    /// 点击物品时,对物品弹框赋值
    /// </summary>
    /// <param name="item"></param>
    public void ClickItem(ItemUIView item)
    {
        if (item == null)
        {
            return;
        }
        ItemUIView itemUI = null;

        for (int i = 0; i < itemUIList.Count; i++)
        {
            if (item.itemUIid == itemUIList[i].itemUIid)
            {
                itemUI = itemUIList[i];
            }
        }
        if (curId == itemUI.itemUIid)
        {
            quantity_txt.text = item.num_txt.text;
        }
        else
        {
            curId             = itemUI.itemUIid;
            itemname_txt.text = JsonMgr.GetSingleton().GetItemConfigByID(itemUI.itemUIid).name;
            quantity_txt.text = item.num_txt.text;
            ItemConfig ic = JsonMgr.GetSingleton().GetItemConfigByID(itemUI.itemUIid);
            itemiconcolor_img.sprite = ResourceMgr.Instance.LoadSprite(ColorMgr.Border[ic.rare - 1]);
            itemicon_img.sprite      = ResourceMgr.Instance.LoadSprite(ic.icon);
            propertydes_txt.text     = JsonMgr.GetSingleton().GetItemConfigByID(itemUI.itemUIid).propertydes;
            use_txt.text             = JsonMgr.GetSingleton().GetItemConfigByID(itemUI.itemUIid).usedes;
            unitprice_txt.text       = JsonMgr.GetSingleton().GetItemConfigByID(itemUI.itemUIid).price.ToString();
        }
        inventorypop_obj.SetActive(true);
        if (JsonMgr.GetSingleton().GetItemConfigByID(itemUI.itemUIid).type == FuncType.CONSUMABLES)
        {
            use_btn.gameObject.SetActive(true);
            details_btn.gameObject.SetActive(false);
        }
        else
        {
            use_btn.gameObject.SetActive(false);
            details_btn.gameObject.SetActive(true);
        }
    }
    /// <summary>
    /// 显示武将
    /// </summary>
    /// <param name="heross"></param>
    public void ShowHero()
    {
        if (RecruitingMgr.Instance.heroList.Count > heros.Count)
        {
            for (int i = 0; i < RecruitingMgr.Instance.heroList.Count; i++)
            {
                Hero heroses = JsonMgr.GetSingleton().GetHeroByID(RecruitingMgr.Instance.heroList[i]);
                if (i == heros.Count)
                {
                    GameObject   hero   = LoadHero();
                    HeroHaveInfo _heros = hero.GetComponent <HeroHaveInfo>();
                    _heros.Init();
                    _heros.heroid = RecruitingMgr.Instance.heroList[i];
                    heros.Add(_heros);
                }
                IsHeroHead herohead = new IsHeroHead();
                herohead._heros = heroses;
                if (HeroMgr.GetSingleton().HerosContainer.ContainsKey(heroses.ID))
                {
                    herohead.isHave = 1;
                }
                else
                {
                    herohead.isHave = 2;
                }
                herolist.Add(herohead);
            }
            UpdateHero();
        }
        //滑动窗大小
        if (grid == null)
        {
            grid   = hero_obj.GetComponent <GridLayoutGroup>();
            rect   = hero_obj.GetComponent <RectTransform>();
            srrect = allhero_obj.GetComponent <RectTransform>();
        }
        int num  = (int)(srrect.sizeDelta.y / grid.cellSize.y); //行数
        int xnum = (int)(srrect.sizeDelta.x / grid.cellSize.x); //每行个数

        rect.offsetMin = new Vector2(0, -((grid.cellSize.y + grid.spacing.y) * ((heros.Count / xnum) - num)));
        rect.offsetMax = Vector2.zero;
        herohead       = RecruitingMgr.Instance.heroList;
    }
Exemple #17
0
    public void InitAreanDefend()
    {
        List <Vector2Int> stubData = Role.Instance.GetStubData(StubType.PVPDefend);
        int needHead = stubData.Count - _heroHeads.Count;

        if (needHead > 0)
        {
            for (int idx = 0; idx < needHead; ++idx)
            {
                GameObject   HeroHeadGo = GameObject.Instantiate(HeroHead.gameObject, this.defend_obj.transform);
                HeroHeadView view       = HeroHeadGo.GetComponent <HeroHeadView>();
                view.Init();
                _heroHeads.Add(view);
            }
        }

        for (int idx = 0; idx < _heroHeads.Count; ++idx)
        {
            if (idx < stubData.Count)
            {
                int           heroId = (int)stubData[idx].y;
                JsonData.Hero jHero  = JsonMgr.GetSingleton().GetHeroByID(heroId);
                if (jHero == null)
                {
                    EDebug.LogErrorFormat("couldn't find hero {0} in json", heroId);
                    return;
                }
                HeroData hero = HeroMgr.GetSingleton().GetHeroData(heroId);
                if (hero == null)
                {
                    EDebug.LogErrorFormat("couldn't find hero {0}", heroId);
                }
                else
                {
                    _heroHeads[idx].SetHeroInfo(jHero.headid, hero.Rare, hero.Star, hero.Level);
                }
            }
            else
            {
                _heroHeads[idx].gameObject.SetActive(false);
            }
        }
    }
Exemple #18
0
    public Sprite LoadSprite(int id)
    {
        var jSprite = JsonMgr.GetSingleton().GetSpriteArrayByID(id);

        if (jSprite == null)
        {
            Debug.LogErrorFormat("LoadSprite failed, no such spriteid:{0}", id);
            return(null);
        }
        string name = jSprite.ResourcePath.ToString();

#if USE_ASSETBUNDLE
        //如果没有就尝试load一下
        if (!_allSprite.ContainsKey(name))
        {
            string assetBundleName = jSprite.ResourceName.ToString();
            if (_allAssetBundles.ContainsKey(assetBundleName))
            {
                Sprite[] sprites = _allAssetBundles[assetBundleName].LoadAllAssets <Sprite>();
                for (int idx = 0; idx < sprites.Length; ++idx)
                {
                    Sprite sp = sprites[idx];
                    _allSprite.Add(sp.name, sp);
                }
            }
        }
        if (_allSprite.ContainsKey(name))
        {
            return(_allSprite[name]);
        }
        Debug.LogErrorFormat("LoadSprite failed,no such sprite name:{0} or the bundle has not been loaded.", name);
        return(null);
#else
        try
        {
            return((Resources.Load(string.Format("Sprite/{0}", name)) as GameObject).GetComponent <SpriteRenderer>().sprite);
        }catch (System.Exception e)
        {
            throw new System.Exception(name.ToString());
        }
#endif
    }
Exemple #19
0
    public void AddBuff(FightUnit caster, int tplId, int buffLevel)
    {
        JObject buffJson = JsonMgr.GetSingleton().GetBuff(tplId);

        if (buffJson == null)
        {
            EDebug.LogErrorFormat("BuffMgr.AddBuff, failed to get buff json, id:{0}", tplId);
            return;
        }

        int  type   = buffJson["type"].ToObject <int>();
        int  layers = buffJson["layers"].ToObject <int>();
        int  resid  = buffJson["resid"].ToObject <int>();
        bool onfoot = buffJson["onfoot"].ToObject <int>() != 0;

        int     calType      = buffJson["caltype"].ToObject <int>();
        JArray  buffParam    = buffJson["buffparam"].ToObject <JArray>();
        int     buffPriority = buffJson["priority"].ToObject <int>();
        Vector3 effectParam  = AttrUtil.CalExpression(calType, buffParam, caster, this._unit, buffLevel);

        Buff buff = new Buff(this, caster, buffLevel, ++_uid, tplId, effectParam);

        if (checkPriority(buffPriority))
        {
            int curLayer = getCurLayer(tplId);
            if (curLayer >= layers)
            {
                removeFirstBuff(tplId);
            }
            if (0 == getCurLayer(tplId) && resid > 0)
            {
                //通知显示层显示特效
                ZEventSystem.Dispatch(EventConst.OnFightUnitAddBuff, this._unit, resid, onfoot, true);
            }

            if (type == (int)BuffType.Time)
            {
                TakeEffect(buff);
            }
            _allBuff.Add(buff);
        }
    }
    private void Instantiate(string id)
    {
        GameObject         go  = Instantiate(item, itemparent_trf, false);
        DivinationItemView div = go.GetComponent <DivinationItemView>();
        TotemData          td  = TotemMgr.GetSingleton().GetTotemByID(id);

        if (td == null)
        {
            td = new TotemData(40007)
            {
                md5 = id
            };
            TotemMgr.GetSingleton().AddTotem(td);
        }
        div.SetView(td);
        EventListener.Get(go).OnClick = e =>
        {
            ZEventSystem.Register(EventConst.ONOPENCOMPOSE, this, "OnOpenCompose");
            UIFace.GetSingleton().Open(UIID.DivinationTip, td, SHOWBUTTON.Ecompose);
            if (!select_trf.gameObject.activeInHierarchy)
            {
                select_trf.gameObject.SetActive(true);
            }
            select_trf.SetParent(go.transform);
            select_trf.transform.localPosition = Vector3.zero;
        };
        EventListener.Get(go).BegineDragEvent = e =>
        {
            Item_sr.OnBeginDrag(e);
        };
        EventListener.Get(go).DragEvent = e =>
        {
            Item_sr.OnDrag(e);
        };
        EventListener.Get(go).EndDragEvent = e =>
        {
            Item_sr.OnEndDrag(e);
        };
        Role.Instance.DivinationLucky += JsonMgr.GetSingleton().GetTotemTreeByID(progress + 1).spend;
        lucky_img.fillAmount           = Role.Instance.DivinationLucky / maxLucky;
    }
 public void SetView(HeroData heroData)
 {
     dontTakePart.Clear();
     EquipData[] equips = heroData.GetEquip();
     for (int i = 0; i < partDic.Count; ++i)
     {
         EquipData data = equips[i];
         EquipPart part = (EquipPart)(i + 1);
         if (data == null)
         {
             dontTakePart.Add(part);
             partDic[part].image.gameObject.SetActive(false);
             partDic[part].level.text = "";
             continue;
         }
         partDic[part].image.gameObject.SetActive(true);
         EventListener.Get(partArray[i].image.gameObject).OnClick = e =>
         {
             if (data == null)
             {
                 return;
             }
             UIFace.GetSingleton().Open(UIID.StrengthenTip, data);
         };
         if (partDic.ContainsKey(part))
         {
             int id = JsonMgr.GetSingleton().GetItemConfigByID(data.EquipId).icon;
             partDic[part].image.sprite = ResourceMgr.Instance.LoadSprite(id);
             partDic[part].level.text   = data.StrengthenLv > 0 ? "+" + data.StrengthenLv : "";
             if (partDic[part].floor != null)
             {
                 partDic[part].floor.SetAlpha(data.StrengthenLv);
             }
         }
     }
     for (int i = 0; i < dontTakePart.Count; i++)
     {
         string md5 = EquipMgr.GetSingleton().TestCanDress(dontTakePart[i], heroData);
         partDic[dontTakePart[i]].cr.SetAlpha(md5 != "" ? 1 : 0);
     }
 }
Exemple #22
0
    private void _makeEffect()
    {
        if (this.User == null || this.Target == null || this.Target.IsDead)
        {
            EDebug.LogErrorFormat("BulletObj._makeEffect failed, User {0} Target {1}", this.User, this.Target);
            return;
        }


        for (int idx = 0; idx < this.Effects.Length; ++idx)
        {
            JObject ceffect    = JsonMgr.GetSingleton().GetSkillEffect(this.Effects[idx]);
            int     effectType = ceffect["effect"].ToObject <int>();
            if (effectType == (int)EffectType.BULLET)
            {
                EDebug.LogErrorFormat("BulletId {0} effect {1} create bullet again", this.TplId, this.Effects[idx]);
                continue;
            }
            this.User.MakeEffect(ceffect, CSkill.ID, SkillLevel, Target);
        }
    }
Exemple #23
0
    public void CreateTreasure(Vector2 pos, int cnt)
    {
        if (cnt <= 0)
        {
            return;
        }
        var drops = JsonMgr.GetSingleton().GetDropOrderArray();

        for (int i = 0, length = drops.Length; i < length && i < cnt; i++)
        {
            var     offset  = drops[i];
            float   offsetX = offset.x * TreasureSize;
            float   offsetY = offset.y * TreasureSize;
            DropObj obj     = new DropObj
            {
                TreasureObj = GameObject.Instantiate(_treasureBox)
            };
            obj.TreasureObj.transform.localPosition = new Vector3(pos.x + offsetX, 0.1f, pos.y + offsetY);
            _dropList.Add(obj);
        }
    }
    public void Open(int heroId)
    {
        data = HeroMgr.GetSingleton().GetHeroData(heroId);
        HeroName_txt.text = data.JsonData.name;

        int[] matnum = JsonMgr.GetSingleton().GetHeroStarByID(heroId).matnum;
        //取下一星级需要数量 刚好为当前星级下标
        int needPiece = matnum[data.Star];

        Piece_txt.text = data.Piece + "/" + needPiece;
        //边框为碎片稀有度 -- 固定
        //OfficerUp officerUp = JsonMgr.GetSignleton().GetOfficerUpByID(data.Rare);
        //broder_img.sprite = ResourceMgr.Instance.LoadSprite(officerUp.CardBorder);
        //碎片ID没定
        piece_img.sprite = ResourceMgr.Instance.LoadSprite(data.JsonData.headid);

        EventListener.Get(close_btn.gameObject).OnClick = e =>
        {
            UIFace.GetSingleton().Close(UIID.HeroGoto);
        };
    }
Exemple #25
0
    private void _analyzeBullet(int bulletId, ref HashSet <int> sound, ref HashSet <int> gos)
    {
        var jBullet = JsonMgr.GetSingleton().GetBulletByID(bulletId);

        if (jBullet == null)
        {
            EDebug.LogErrorFormat("PreloadMgr._analyzeBullet failed, no such bullet:{0}", bulletId);
            return;
        }
        int resId = jBullet.resid;

        if (resId != 0)
        {
            gos.Add(resId);
        }
        int[] effects = jBullet.effects;
        for (int idx = 0; idx < effects.Length; ++idx)
        {
            _analyzeEffect(effects[idx], ref sound, ref gos);
        }
    }
Exemple #26
0
 public Dictionary <Attr, float> OfficerAttr()
 {
     if (officerAttr == null)
     {
         do
         {
             officerAttr = new Dictionary <Attr, float>();
             Officer o = JsonMgr.GetSingleton().GetOfficerByID(Officer);
             if (o == null)
             {
                 break;
             }
             for (int i = 0, length = o.attrerty.Length; i < length; ++i)
             {
                 Pro pro = o.attrerty[i];
                 officerAttr.Add(pro.attr, pro.num);
             }
         } while (false);
     }
     return(officerAttr);
 }
Exemple #27
0
 public SkillMgr(FightUnit unit, Dictionary <int, int> skillData, int[] skills, int[] initSkillTurn, int[] skillTurn, int activeSkill, int normalSkill)
 {
     this._unit          = unit;
     this._skillData     = skillData;
     this._allSkills     = skills;
     this._initSkillTurn = initSkillTurn;
     this._skillTurn     = skillTurn;
     this._skillFlag     = 0;
     this._skillInited   = false;
     this._activeSkill   = activeSkill;
     this._normalSkill   = normalSkill;
     if (this._activeSkill > 0)
     {
         Skill cskill = JsonMgr.GetSingleton().GetSkillByID(activeSkill);
         if (cskill != null)
         {
             this._activeSkillType = cskill.target;
         }
     }
     this._waitActiveSkill = false;
 }
    private void ShowCard()
    {
        showGo = Card_trf;
        showGo.SetParent(Right_trf);

        bigcard_img.sprite = ResourceMgr.Instance.LoadSprite(heroData.JsonData.cardid);
        Worker_img.sprite  = ResourceMgr.Instance.LoadSprite(heroData.JsonData.type);

        HeroRare officerUp = JsonMgr.GetSingleton().GetHeroRareByID(heroData.Rare);

        Floor_img.sprite = ResourceMgr.Instance.LoadSprite(officerUp.CardBorder);
        Trans_img.sprite = ResourceMgr.Instance.LoadSprite(officerUp.CardTrans);

        for (int i = 0, length = crArray.Length; i < length; ++i)
        {
            crArray[i].SetAlpha(i < heroData.Star ? 1 : 0);
        }
        ///暂用 武将满星后处理待定....
        int[] matnum    = JsonMgr.GetSingleton().GetHeroStarByID(heroData.HeroId).matnum;
        int   needPiece = matnum[Mathf.Min(heroData.Star, matnum.Length - 1)];

        Piece_slider.value = heroData.Piece * 1f / needPiece;
        Num_txt.text       = heroData.Piece + "/" + needPiece;
        //升星减碎片
        if (heroData.Star >= HeroMgr.MaxHeroStar)
        {
            StarUp_btn.interactable = false;
        }
        else
        {
            StarUp_btn.interactable = true;
            EventListener.Get(StarUp_btn.gameObject).OnClick = go =>
            {
                if (StarUp_btn.interactable)
                {
                    UIFace.GetSingleton().Open(UIID.HeroStarUp, heroData.HeroId);
                }
            };
        }
    }
Exemple #29
0
    /// <summary>
    /// 通过类型获取物品
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    public List <ItemUIView> GetItemsByType(FuncType type)
    {
        List <ItemUIView> itemUItype = new List <ItemUIView>();

        for (int i = 0; i < itemUIList.Count; i++)
        {
            if (i >= ItemMgr.Instance.itemList.Count)
            {
                return(itemUItype);
            }
            if (JsonMgr.GetSingleton().GetItemConfigByID(itemUIList[i].itemUIid).type == type)
            {
                itemUIList[i].gameObject.SetActive(true);
                itemUItype.Add(itemUIList[i]);
            }
            else
            {
                itemUIList[i].gameObject.SetActive(false);
            }
        }
        return(itemUItype);
    }
Exemple #30
0
    private void _analyzeEffect(int effectId, ref HashSet <int> sound, ref HashSet <int> gos)
    {
        JObject jEffect = JsonMgr.GetSingleton().GetSkillEffect(effectId);

        if (jEffect == null)
        {
            EDebug.LogErrorFormat("PreloadMgr._analyzeEffect failed, no such effect:{0}", effectId);
            return;
        }
        int hitEffect = jEffect["hiteffect"].ToObject <int>();

        if (hitEffect != 0)
        {
            gos.Add(hitEffect);
        }
        int effect    = jEffect["effect"].ToObject <int>();
        int paramType = jEffect["paramtype"].ToObject <int>();

        if (1 == paramType)
        {
            return;
        }
        Vector3 EffectParams = AttrUtil.CalExpression(paramType, jEffect["effectparam"].ToObject <JArray>());

        switch (effect)
        {
        case (int)EffectType.BULLET:
            _analyzeBullet((int)EffectParams.y, ref sound, ref gos);
            break;

        case (int)EffectType.BUFF:
            _analyzeBuffRes((int)EffectParams.y, ref sound, ref gos);
            break;

        case (int)EffectType.Summon:
            _analyzeFighterRes((int)EffectParams.x, true, ref sound, ref gos);
            break;
        }
    }