public void UpdateFace(FaceType _type, int _id) { switch (_type) { case FaceType.眼睛: faces[_type].sprite = EyeConfig.Get(_id).GetSprite(); break; case FaceType.嘴巴: faces[_type].sprite = MouthConfig.Get(_id).GetSprite(); break; case FaceType.发型: faces[_type].sprite = HairConfig.Get(_id).GetSprite(); break; case FaceType.耳朵: faces[_type].sprite = EarConfig.Get(_id).GetSprite(); break; case FaceType.发饰: faces[_type].sprite = HairDecorateConfig.Get(_id).GetSprite(); break; default: break; } }
public void UpdateFace(Dictionary <FaceType, int> dict) { foreach (var item in dict) { var _type = item.Key; var _id = item.Value; switch (_type) { case FaceType.眼睛: faces[_type].sprite = EyeConfig.Get(_id).GetSprite(); break; case FaceType.嘴巴: faces[_type].sprite = MouthConfig.Get(_id).GetSprite(); break; case FaceType.发型: faces[_type].sprite = HairConfig.Get(_id).GetSprite(); break; case FaceType.耳朵: faces[_type].sprite = EarConfig.Get(_id).GetSprite(); break; case FaceType.发饰: faces[_type].sprite = HairDecorateConfig.Get(_id).GetSprite(); break; default: break; } } }
public void UpdateSpriteRenderSprite() { switch (facetype) { case FaceType.眼睛: _sprite.sprite = EyeConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite(); break; case FaceType.嘴巴: _sprite.sprite = MouthConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite(); break; case FaceType.发型: _sprite.sprite = HairConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite(); break; case FaceType.耳朵: _sprite.sprite = EarConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite(); break; case FaceType.发饰: _sprite.sprite = HairDecorateConfig.Get(ActorModel.Model.GetFace(facetype)).GetSprite(); break; default: break; } }
public void SetConfig(FaceType _type, int config_id, UnityAction <FaceUICell> on_click_call_back) { this.on_click_call_back = on_click_call_back; this._type = _type; this.config_id = config_id; switch (_type) { case FaceType.眼睛: cell_image.sprite = EyeConfig.Get(config_id).GetSprite(); break; case FaceType.嘴巴: cell_image.sprite = MouthConfig.Get(config_id).GetSprite(); break; case FaceType.发型: cell_image.sprite = HairConfig.Get(config_id).GetSprite(); break; case FaceType.耳朵: cell_image.sprite = EarConfig.Get(config_id).GetSprite(); break; case FaceType.发饰: cell_image.sprite = HairDecorateConfig.Get(config_id).GetSprite(); break; default: break; } }
static public void LoadFromJson(JsonData json) { WeaponConfig.LoadFromJson(json["Weapon"]); EnemyConfig.LoadFromJson(json["Enemy"]); FootConfig.LoadFromJson(json["Foot"]); SleeveConfig.LoadFromJson(json["Sleeve"]); ArmConfig.LoadFromJson(json["Arm"]); PelvisConfig.LoadFromJson(json["Pelvis"]); EyeConfig.LoadFromJson(json["EyeConfig"]); MouthConfig.LoadFromJson(json["MouthConfig"]); HairConfig.LoadFromJson(json["HairConfig"]); EarConfig.LoadFromJson(json["EarConfig"]); SkillConfig.LoadFromJson(json["Skill"]); TorsoConfig.LoadFromJson(json["Torso"]); ShieldConfig.LoadFromJson(json["Shield"]); SuitConfig.LoadFromJson(json["Suit"]); ConsumablesConfig.LoadFromJson(json["Consumables"]); HairDecorateConfig.LoadFromJson(json["HairDecorateConfig"]); }
public void SetType(int t) { foreach (var item in cell_lists) { Destroy(item); } cell_lists.Clear(); var _type = (FaceType)t; switch (_type) { case FaceType.眼睛: EyeConfig.Get(1); foreach (var _config in EyeConfig.Datas) { var cell = Instantiate(Cell, Root); cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select); if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type)) { Select(cell.GetComponent <FaceUICell>()); } cell_lists.Add(cell); } break; case FaceType.嘴巴: MouthConfig.Get(1); foreach (var _config in MouthConfig.Datas) { var cell = Instantiate(Cell, Root); cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select); if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type)) { Select(cell.GetComponent <FaceUICell>()); } cell_lists.Add(cell); } break; case FaceType.发型: HairConfig.Get(1); foreach (var _config in HairConfig.Datas) { var cell = Instantiate(Cell, Root); cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select); if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type)) { Select(cell.GetComponent <FaceUICell>()); } cell_lists.Add(cell); } break; case FaceType.耳朵: EarConfig.Get(1); foreach (var _config in EarConfig.Datas) { var cell = Instantiate(Cell, Root); cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select); if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type)) { Select(cell.GetComponent <FaceUICell>()); } cell_lists.Add(cell); } break; case FaceType.发饰: HairDecorateConfig.Get(1); foreach (var _config in HairDecorateConfig.Datas) { var cell = Instantiate(Cell, Root); cell.GetComponent <FaceUICell>().SetConfig(_type, _config.Value.ID, Select); if (cell_lists.Count + 1 == ActorModel.Model.GetFace(_type)) { Select(cell.GetComponent <FaceUICell>()); } cell_lists.Add(cell); } break; default: break; } }
// Update is called once per frame protected override void OnBeginDrawEditors() { var selected = this.MenuTree.Selection.FirstOrDefault(); var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight; SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight); { foreach (var temp in Enum.GetNames(typeof(FaceType))) { if (SirenixEditorGUI.ToolbarButton(new GUIContent(" " + temp + " "))) { config_type = (FaceType)Enum.Parse(typeof(FaceType), temp); ForceMenuTreeRebuild(); } } SirenixEditorGUI.ToolbarTab(false, ""); if (SirenixEditorGUI.ToolbarButton(new GUIContent(" + ")) && !isCreate) { isCreate = true; switch (config_type) { case FaceType.眼睛: CreateItem(new EyeConfig(), ref _tree); break; case FaceType.嘴巴: CreateItem(new MouthConfig(), ref _tree); break; case FaceType.发型: CreateItem(new HairConfig(), ref _tree); break; case FaceType.耳朵: CreateItem(new EarConfig(), ref _tree); break; case FaceType.发饰: CreateItem(new HairDecorateConfig(), ref _tree); break; default: break; } } if (SirenixEditorGUI.ToolbarButton(new GUIContent(" 添加所有 "))) { switch (config_type) { case FaceType.眼睛: EyeConfig.LoadAll(); break; case FaceType.嘴巴: MouthConfig.LoadAll(); break; case FaceType.发型: HairConfig.LoadAll(); break; case FaceType.耳朵: EarConfig.LoadAll(); break; case FaceType.发饰: HairDecorateConfig.LoadAll(); break; default: break; } } if (SirenixEditorGUI.ToolbarButton(new GUIContent(" 移除所有 "))) { switch (config_type) { case FaceType.眼睛: EyeConfig.RemoveAll(); break; case FaceType.嘴巴: MouthConfig.RemoveAll(); break; case FaceType.发型: HairConfig.RemoveAll(); break; case FaceType.耳朵: EarConfig.RemoveAll(); break; case FaceType.发饰: HairDecorateConfig.RemoveAll(); break; default: break; } } SirenixEditorGUI.EndHorizontalToolbar(); } }
public void SetModel(ActorModel _model) { foreach (var item in _model.Equipment) { Sprite sp = null; switch (item.Key) { case EquipmentType.鞋子: sp = FootConfig.Get(item.Value).GetSprite(); break; case EquipmentType.裤子: sp = PelvisConfig.Get(item.Value).GetSprite(); break; case EquipmentType.肩膀左: sp = ArmConfig.Get(item.Value).GetLsprite(); break; case EquipmentType.肩膀右: sp = ArmConfig.Get(item.Value).GetSprite(); break; case EquipmentType.手链: sp = SleeveConfig.Get(item.Value).GetSprite(); break; case EquipmentType.武器: sp = WeaponConfig.Get(item.Value).GetSprite(); break; case EquipmentType.衣: sp = TorsoConfig.Get(item.Value).GetSprite(); break; case EquipmentType.盾牌: sp = ShieldConfig.Get(item.Value).GetSprite(); break; default: break; } if (equipment.ContainsKey(item.Key)) { equipment[item.Key].sprite = sp; } } foreach (var item in _model.Faces) { Sprite sp = null; switch (item.Key) { case FaceType.发型: sp = HairConfig.Get(item.Value).GetSprite(); break; case FaceType.眼睛: sp = EyeConfig.Get(item.Value).GetSprite(); break; case FaceType.嘴巴: sp = MouthConfig.Get(item.Value).GetSprite(); break; case FaceType.耳朵: sp = EarConfig.Get(item.Value).GetSprite(); break; case FaceType.发饰: sp = HairDecorateConfig.Get(item.Value).GetSprite(); break; default: break; } face[item.Key].sprite = sp; } }