/// <summary> /// 获取皮肤颜色 /// </summary> /// <returns></returns> public Color GetColorSkin() { if (colorSkin == null) { colorSkin = new ColorBean(1, 1, 1, 1); } return(colorSkin.GetColor()); }
/// <summary> /// 获取头发颜色 /// </summary> /// <returns></returns> public Color GetColorHair() { if (colorHair == null) { colorHair = new ColorBean(1, 1, 1, 1); } return(colorHair.GetColor()); }
public CharacterBodyBean() { sex = 1; eye = "character_eye_0"; mouth = "character_mouth_0"; skinColor = ColorBean.White(); hairColor = ColorBean.White(); eyeColor = ColorBean.White(); mouthColor = ColorBean.White(); }
/// <summary> /// 获取颜色 /// </summary> /// <returns></returns> public ColorBean GetColorBean() { if (colorR == null || colorG == null || colorB == null) { return(null); } ColorBean colorBean = new ColorBean(); colorBean.r = colorR.value; colorBean.g = colorG.value; colorBean.b = colorB.value; colorBean.a = 1; return(colorBean); }
/// <summary> /// Color转换ColorBean /// </summary> /// <param name="color"></param> /// <returns></returns> public static ColorBean ColorToColorBean(Color color) { ColorBean colorBean = new ColorBean(color.r, color.g, color.b, color.a); return(colorBean); }
public void SetCampColor(Color color) { campColor = new ColorBean(color.r, color.g, color.b); }
/// <summary> /// Npc Item /// </summary> public static void GUINpcInfoItem(GameObject objNpcContainer, NpcInfoBean npcInfo) { if (GUILayout.Button("获取场景位置数据", GUILayout.Width(120), GUILayout.Height(20))) { BaseNpcAI npcAI = objNpcContainer.GetComponentInChildren <BaseNpcAI>(); npcInfo.position_x = npcAI.transform.position.x; npcInfo.position_y = npcAI.transform.position.y; } GUILayout.Label("NPCID:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.id = long.Parse(EditorGUILayout.TextArea(npcInfo.id + "", GUILayout.Width(100), GUILayout.Height(20))); npcInfo.npc_id = npcInfo.id; GUILayout.BeginHorizontal(); npcInfo.npc_type = (int)EditorUI.GUIEnum <NpcTypeEnum>("Npc类型:", npcInfo.npc_type); NpcTypeEnum npcType = (NpcTypeEnum)npcInfo.npc_type; GUILayout.Label("对话选项:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.talk_types = EditorUI.GUIEditorText(npcInfo.talk_types, 50); GUILayout.EndHorizontal(); if (npcType != NpcTypeEnum.Passerby) { GUILayout.BeginHorizontal(); GUILayout.Label("姓名:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.name = EditorGUILayout.TextArea(npcInfo.name + "", GUILayout.Width(100), GUILayout.Height(20)); GUILayout.Label("性别:1男 2女", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.sex = int.Parse(EditorGUILayout.TextArea(npcInfo.sex + "", GUILayout.Width(30), GUILayout.Height(20))); GUILayout.Label("称号:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.title_name = EditorGUILayout.TextArea(npcInfo.title_name + "", GUILayout.Width(100), GUILayout.Height(20)); GUILayout.Label("朝向 1左 2右", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.face = int.Parse(EditorGUILayout.TextArea(npcInfo.face + "", GUILayout.Width(30), GUILayout.Height(20))); GUILayout.Label("位置XY:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.position_x = float.Parse(EditorGUILayout.TextArea(npcInfo.position_x + "", GUILayout.Width(100), GUILayout.Height(20))); npcInfo.position_y = float.Parse(EditorGUILayout.TextArea(npcInfo.position_y + "", GUILayout.Width(100), GUILayout.Height(20))); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("眼睛:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.eye_id = EditorGUILayout.TextArea(npcInfo.eye_id + "", GUILayout.Width(200), GUILayout.Height(20)); string eyePath = "Assets/Texture/Character/Eye/"; EditorUI.GUIPic(eyePath, npcInfo.eye_id); GUILayout.Label("眼睛颜色:", GUILayout.Width(100), GUILayout.Height(20)); ColorBean eyeColorData = new ColorBean(npcInfo.eye_color); Color eyeColor = eyeColorData.GetColor();; eyeColor = EditorGUILayout.ColorField(eyeColor, GUILayout.Width(50), GUILayout.Height(20)); npcInfo.eye_color = eyeColor.r + "," + eyeColor.g + "," + eyeColor.b + "," + eyeColor.a; GUILayout.Label("嘴巴:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.mouth_id = EditorGUILayout.TextArea(npcInfo.mouth_id + "", GUILayout.Width(200), GUILayout.Height(20)); string mouthPath = "Assets/Texture/Character/Mouth/"; EditorUI.GUIPic(mouthPath, npcInfo.mouth_id); GUILayout.Label("嘴巴颜色:", GUILayout.Width(100), GUILayout.Height(20)); ColorBean mouthColorData = new ColorBean(npcInfo.mouth_color); Color mouthColor = mouthColorData.GetColor();; mouthColor = EditorGUILayout.ColorField(mouthColor, GUILayout.Width(50), GUILayout.Height(20)); npcInfo.mouth_color = mouthColor.r + "," + mouthColor.g + "," + mouthColor.b + "," + mouthColor.a; GUILayout.Label("头发:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.hair_id = EditorGUILayout.TextArea(npcInfo.hair_id + "", GUILayout.Width(200), GUILayout.Height(20)); string hairPath = "Assets/Texture/Character/Hair/"; EditorUI.GUIPic(hairPath, npcInfo.hair_id); GUILayout.Label("头发颜色:", GUILayout.Width(100), GUILayout.Height(20)); ColorBean hairColorData = new ColorBean(npcInfo.hair_color); Color hairColor = hairColorData.GetColor();; hairColor = EditorGUILayout.ColorField(hairColor, GUILayout.Width(50), GUILayout.Height(20)); npcInfo.hair_color = hairColor.r + "," + hairColor.g + "," + hairColor.b + "," + hairColor.a; GUILayout.Label("皮肤颜色:", GUILayout.Width(100), GUILayout.Height(20)); ColorBean skinColorData = new ColorBean(npcInfo.skin_color); Color skinColor = skinColorData.GetColor();; skinColor = EditorGUILayout.ColorField(skinColor, GUILayout.Width(50), GUILayout.Height(20)); npcInfo.skin_color = skinColor.r + "," + skinColor.g + "," + skinColor.b + "," + skinColor.a; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("命:", GUILayout.Width(30), GUILayout.Height(20)); npcInfo.attributes_life = int.Parse(EditorGUILayout.TextArea(npcInfo.attributes_life + "", GUILayout.Width(50), GUILayout.Height(20))); GUILayout.Label("厨:", GUILayout.Width(30), GUILayout.Height(20)); npcInfo.attributes_cook = int.Parse(EditorGUILayout.TextArea(npcInfo.attributes_cook + "", GUILayout.Width(50), GUILayout.Height(20))); GUILayout.Label("速:", GUILayout.Width(30), GUILayout.Height(20)); npcInfo.attributes_speed = int.Parse(EditorGUILayout.TextArea(npcInfo.attributes_speed + "", GUILayout.Width(50), GUILayout.Height(20))); GUILayout.Label("算:", GUILayout.Width(30), GUILayout.Height(20)); npcInfo.attributes_account = int.Parse(EditorGUILayout.TextArea(npcInfo.attributes_account + "", GUILayout.Width(50), GUILayout.Height(20))); GUILayout.Label("魅:", GUILayout.Width(30), GUILayout.Height(20)); npcInfo.attributes_charm = int.Parse(EditorGUILayout.TextArea(npcInfo.attributes_charm + "", GUILayout.Width(50), GUILayout.Height(20))); GUILayout.Label("武:", GUILayout.Width(30), GUILayout.Height(20)); npcInfo.attributes_force = int.Parse(EditorGUILayout.TextArea(npcInfo.attributes_force + "", GUILayout.Width(50), GUILayout.Height(20))); GUILayout.Label("运:", GUILayout.Width(30), GUILayout.Height(20)); npcInfo.attributes_lucky = int.Parse(EditorGUILayout.TextArea(npcInfo.attributes_lucky + "", GUILayout.Width(50), GUILayout.Height(20))); if (npcType == NpcTypeEnum.RecruitTown) { GUILayout.Label("忠诚:", GUILayout.Width(30), GUILayout.Height(20)); npcInfo.attributes_loyal = int.Parse(EditorGUILayout.TextArea(npcInfo.attributes_loyal + "", GUILayout.Width(50), GUILayout.Height(20))); GUILayout.Label("工资 S:", GUILayout.Width(30), GUILayout.Height(20)); npcInfo.wage_s = int.Parse(EditorGUILayout.TextArea(npcInfo.wage_s + "", GUILayout.Width(50), GUILayout.Height(20))); } GUILayout.Label("喜欢的东西ID(用,分隔):", GUILayout.Width(150), GUILayout.Height(20)); npcInfo.love_items = EditorGUILayout.TextArea(npcInfo.love_items + "", GUILayout.Width(100), GUILayout.Height(20)); GUILayout.Label("喜欢的菜品:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.love_menus = EditorGUILayout.TextArea(npcInfo.love_menus + "", GUILayout.Width(50), GUILayout.Height(20)); GUILayout.Label("技能:", GUILayout.Width(100), GUILayout.Height(20)); npcInfo.skill_ids = EditorUI.GUIEditorText(npcInfo.skill_ids, 100); GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); EditorUI.GUIText("|", 10); EditorUI.GUIText("面具:", 50); npcInfo.mask_id = long.Parse(EditorGUILayout.TextArea(npcInfo.mask_id + "", GUILayout.Width(100), GUILayout.Height(20))); string maskPath = "Assets/Texture/Character/Dress/Mask/"; ItemsInfoBean maskInfo = GameItemsHandler.Instance.manager.GetItemsById(npcInfo.mask_id); if (maskInfo != null) { EditorUI.GUIPic(maskPath, maskInfo.icon_key); } EditorUI.GUIText("|", 10); EditorUI.GUIText("帽子:", 50); npcInfo.hat_id = long.Parse(EditorGUILayout.TextArea(npcInfo.hat_id + "", GUILayout.Width(100), GUILayout.Height(20))); string hatPath = "Assets/Texture/Character/Dress/Hat/"; ItemsInfoBean hatInfo = GameItemsHandler.Instance.manager.GetItemsById(npcInfo.hat_id); if (hatInfo != null) { EditorUI.GUIPic(hatPath, hatInfo.icon_key); } EditorUI.GUIText("|", 10); EditorUI.GUIText("衣服:", 50); npcInfo.clothes_id = long.Parse(EditorGUILayout.TextArea(npcInfo.clothes_id + "", GUILayout.Width(100), GUILayout.Height(20))); string clothesPath = "Assets/Texture/Character/Dress/Clothes/"; ItemsInfoBean clothesInfo = GameItemsHandler.Instance.manager.GetItemsById(npcInfo.clothes_id); if (clothesInfo != null) { EditorUI.GUIPic(clothesPath, clothesInfo.icon_key); } EditorUI.GUIText("|", 10); EditorUI.GUIText("鞋子:", 50); npcInfo.shoes_id = long.Parse(EditorGUILayout.TextArea(npcInfo.shoes_id + "", GUILayout.Width(100), GUILayout.Height(20))); string shoesPath = "Assets/Texture/Character/Dress/Shoes/"; ItemsInfoBean shoesInfo = GameItemsHandler.Instance.manager.GetItemsById(npcInfo.shoes_id); if (shoesInfo != null) { EditorUI.GUIPic(shoesPath, shoesInfo.icon_key); } EditorUI.GUIText("|", 10); EditorUI.GUIText("武器:", 50); npcInfo.hand_id = long.Parse(EditorGUILayout.TextArea(npcInfo.hand_id + "", GUILayout.Width(100), GUILayout.Height(20))); ItemsInfoBean handInfo = GameItemsHandler.Instance.manager.GetItemsById(npcInfo.hand_id); if (handInfo != null) { EditorUI.GUIText(handInfo.name, 50); } EditorUI.GUIText("|", 10); GUILayout.EndHorizontal(); npcInfo.condition = EditorUI.GUIListData <ShowConditionEnum>("Npc出现条件", npcInfo.condition); }
/// <summary> /// 设置头发原色 /// </summary> /// <param name="color"></param> public void SetColorSkin(Color color) { colorSkin = new ColorBean(color); }
/// <summary> /// 设置头发颜色 /// </summary> /// <param name="color"></param> public void SetColorHair(Color color) { colorHair = new ColorBean(color); }
public void CreateRandomMouth() { mouth = CharacterBodyHandler.Instance.manager.GetRandomMouthStr(); mouthColor = ColorBean.Random(); }
public void CreateRandomHair() { hair = CharacterBodyHandler.Instance.manager.GetRandomHairStr(); hairColor = ColorBean.Random(); }
public void CreateRandomEye() { eye = CharacterBodyHandler.Instance.manager.GetRandomEyeStr(); eyeColor = ColorBean.Random(); }
public CharacterBean(NpcInfoBean npcInfo) { baseInfo.characterType = npcInfo.npc_type; baseInfo.characterId = npcInfo.id + ""; baseInfo.titleName = npcInfo.title_name; baseInfo.name = npcInfo.name; baseInfo.priceL = npcInfo.wage_l; baseInfo.priceM = npcInfo.wage_m; baseInfo.priceS = npcInfo.wage_s; //设置最喜欢的东西 if (!CheckUtil.StringIsNull(npcInfo.love_items)) { baseInfo.listLoveItems = StringUtil.SplitBySubstringForArrayLong(npcInfo.love_items, ',').ToList(); } body = new CharacterBodyBean(); body.hair = npcInfo.hair_id; //设置头发颜色 ColorBean hairColor = new ColorBean(npcInfo.hair_color); if (hairColor != null) { body.hairColor = hairColor; } body.eye = npcInfo.eye_id; //设置眼睛颜色 ColorBean eyeColor = new ColorBean(npcInfo.eye_color); if (eyeColor != null) { body.eyeColor = eyeColor; } body.mouth = npcInfo.mouth_id; //设置嘴巴颜色 ColorBean mouthColor = new ColorBean(npcInfo.mouth_color); if (mouthColor != null) { body.mouthColor = mouthColor; } body.sex = npcInfo.sex; body.face = npcInfo.face; //设置皮肤颜色 ColorBean skinColor = new ColorBean(npcInfo.skin_color); if (skinColor != null) { body.skinColor = skinColor; } //设置装备 equips = new CharacterEquipBean(); equips.maskId = npcInfo.mask_id; equips.handId = npcInfo.hand_id; equips.hatId = npcInfo.hat_id; equips.clothesId = npcInfo.clothes_id; equips.shoesId = npcInfo.shoes_id; equips.maskId = npcInfo.mask_id; //设置属性 attributes = new CharacterAttributesBean(); attributes.loyal = npcInfo.attributes_loyal; attributes.life = npcInfo.attributes_life; attributes.cook = npcInfo.attributes_cook; attributes.speed = npcInfo.attributes_speed; attributes.account = npcInfo.attributes_account; attributes.charm = npcInfo.attributes_charm; attributes.force = npcInfo.attributes_force; attributes.lucky = npcInfo.attributes_lucky; //设置技能 attributes.listSkills = npcInfo.GetSkillIds(); npcInfoData = npcInfo; }