Example #1
0
        public static string GetPortraitName(LeaderPortraitType type)
        {
            switch (type)
            {
            case LeaderPortraitType.Nose:
                return(MultiLanguage.Instance.GetTextValue(Leader_Portrait_Nose_Name));

            case LeaderPortraitType.Mouth:
                return(MultiLanguage.Instance.GetTextValue(Leader_Portrait_Mouth_Name));

            case LeaderPortraitType.Hair:
                return(MultiLanguage.Instance.GetTextValue(Leader_Portrait_Hair_Name));

            case LeaderPortraitType.Face:
                return(MultiLanguage.Instance.GetTextValue(Leader_Portrait_Face_Name));

            case LeaderPortraitType.Eyes:
                return(MultiLanguage.Instance.GetTextValue(Leader_Portrait_Eyes_Name));

            case LeaderPortraitType.Ear:
                return(MultiLanguage.Instance.GetTextValue(Leader_Portrait_Ear_Name));

            case LeaderPortraitType.Cloth:
                return(MultiLanguage.Instance.GetTextValue(Leader_Portrait_Cloth_Name));

            case LeaderPortraitType.BG:
                return(MultiLanguage.Instance.GetTextValue(Leader_Portrait_BG_Name));

            default:
                return(string.Empty);
            }
        }
Example #2
0
 public override bool OnMessage(UIMessage msg)
 {
     if (msg.type == UIMsgType.LeaderCustom_Refresh_Portrait)
     {
         LeaderPortraitType type = (LeaderPortraitType)msg.content[0];
         int index = (int)msg.content[1];
         return(UpdatePortraitSprite(type, index));
     }
     return(true);
 }
Example #3
0
        /// <summary>
        /// 获取符合要求的自定义列表
        /// </summary>
        /// <param name="type"></param>
        /// <param name="speciesID"></param>
        /// <param name="sexID"></param>
        /// <returns></returns>
        public static List <Config.LeaderPortraitItemConfig> GetLeagalPortraitImte(LeaderPortraitType type, int speciesID, int sexID)
        {
            var config = Config.ConfigData.LeaderPortraitConfig;

            if (type == LeaderPortraitType.BG)
            {
                var list = config.portrait_bg;
                LeaderPortraitListFilter(speciesID, sexID, ref list);
                return(list);
            }
            else if (type == LeaderPortraitType.Cloth)
            {
                var list = config.portrait_cloth;
                LeaderPortraitListFilter(speciesID, sexID, ref list);
                return(list);
            }
            else if (type == LeaderPortraitType.Ear)
            {
                var list = config.portrait_Ear;
                LeaderPortraitListFilter(speciesID, sexID, ref list);
                return(list);
            }
            else if (type == LeaderPortraitType.Eyes)
            {
                var list = config.portrait_eyes;
                LeaderPortraitListFilter(speciesID, sexID, ref list);
                return(list);
            }
            else if (type == LeaderPortraitType.Face)
            {
                var list = config.portrait_face;
                LeaderPortraitListFilter(speciesID, sexID, ref list);
                return(list);
            }
            else if (type == LeaderPortraitType.Hair)
            {
                var list = config.portrait_hair;
                LeaderPortraitListFilter(speciesID, sexID, ref list);
                return(list);
            }
            else if (type == LeaderPortraitType.Mouth)
            {
                var list = config.portrait_Mouth;
                LeaderPortraitListFilter(speciesID, sexID, ref list);
                return(list);
            }
            else if (type == LeaderPortraitType.Nose)
            {
                var list = config.portrait_Nose;
                LeaderPortraitListFilter(speciesID, sexID, ref list);
                return(list);
            }

            return(null);
        }
Example #4
0
 public void SetUpItem(LeaderPortraitType type, int speciesID, int sexID)
 {
     itemList = LeaderModule.GetLeagalPortraitImte(type, speciesID, sexID);
     if (itemList == null || itemList.Count == 0)
     {
         return;
     }
     ///Select Default
     portraitType = type;
     transform.FindTransfrom("Name").SafeGetComponent <Text>().text = LeaderModule.GetPortraitName(type);
     SelectContentName.text = LeaderModule.GetPortraitName(portraitType) + "_" + currentSelectIndex + 1;
     UpdateBtnState();
 }
Example #5
0
        bool UpdatePortraitSprite(LeaderPortraitType type, int index)
        {
            var list = portraitSpriteDic[type];

            if (index > list.Count - 1)
            {
                return(false);
            }
            var sp = Utility.LoadSprite(list[index].spritePath);

            _portraitUI.RefreshSprite(type, sp);
            return(true);
        }
Example #6
0
        public static Config.LeaderPortraitItemConfig GetRandomPortraitItem(LeaderPortraitType type, int speciesID, int sexID)
        {
            var config = Config.ConfigData.LeaderPortraitConfig;

            Func <List <Config.LeaderPortraitItemConfig>, Config.LeaderPortraitItemConfig> GetRandom = (o) =>
            {
                LeaderPortraitListFilter(speciesID, sexID, ref o);
                int index = UnityEngine.Random.Range(0, o.Count);
                return(o[index]);
            };

            if (type == LeaderPortraitType.Cloth)
            {
                return(GetRandom(config.portrait_cloth));
            }
            else if (type == LeaderPortraitType.Ear)
            {
                return(GetRandom(config.portrait_Ear));
            }
            else if (type == LeaderPortraitType.Eyes)
            {
                return(GetRandom(config.portrait_eyes));
            }
            else if (type == LeaderPortraitType.Face)
            {
                return(GetRandom(config.portrait_face));
            }
            else if (type == LeaderPortraitType.Hair)
            {
                return(GetRandom(config.portrait_hair));
            }
            else if (type == LeaderPortraitType.Mouth)
            {
                return(GetRandom(config.portrait_Mouth));
            }
            else if (type == LeaderPortraitType.Nose)
            {
                return(GetRandom(config.portrait_Nose));
            }
            else if (type == LeaderPortraitType.BG)
            {
                return(GetRandom(config.portrait_bg));
            }
            DebugPlus.LogError("[GetRandomPortraitItem] : RandomError! ");
            return(null);
        }
Example #7
0
        public void RefreshSprite(LeaderPortraitType type, Sprite sp)
        {
            switch (type)
            {
            case LeaderPortraitType.BG:
                _bg.sprite = sp;
                break;

            case LeaderPortraitType.Cloth:
                _cloth.sprite = sp;
                break;

            case LeaderPortraitType.Ear:
                _ear.sprite = sp;
                break;

            case LeaderPortraitType.Eyes:
                _eyes.sprite = sp;
                break;

            case LeaderPortraitType.Face:
                _face.sprite = sp;
                break;

            case LeaderPortraitType.Hair:
                _hair.sprite = sp;
                break;

            case LeaderPortraitType.Mouth:
                _mouth.sprite = sp;
                break;

            case LeaderPortraitType.Nose:
                _nose.sprite = sp;
                break;
            }
        }