/// <summary> /// Data Bind /// </summary> public void DataBind(Sprite icon, CharacterDisplay characterDisplay, CharacterBodyType bodyType, int type) { this._CharacterDisplay = characterDisplay; this.ButtonIcon.sprite = icon; this.BodyType = type; this.CharacterBodyType = bodyType; switch (bodyType) { case CharacterBodyType.Head: if (this._CharacterDisplay.CharacterEditPanel.CharacterConfig.HeadType == type) { this.ButtonToggle(false); } break; case CharacterBodyType.Body: if (this._CharacterDisplay.CharacterEditPanel.CharacterConfig.BodyType == type) { this.ButtonToggle(false); } break; case CharacterBodyType.Legs: if (this._CharacterDisplay.CharacterEditPanel.CharacterConfig.LegsType == type) { this.ButtonToggle(false); } break; default: break; } }
/// <summary> /// Change Animator Layer Set /// </summary> public void ChangeAnimatorLayerSet(CharacterBodyType type, int layerType) { switch (type) { case CharacterBodyType.Head: for (int i = 0; i < this.HeadIcon.layerCount; i++) { this.HeadIcon.SetLayerWeight(i, i == layerType ? 1.0f : 0.0f); } break; case CharacterBodyType.Body: for (int i = 0; i < this.BodyIcon.layerCount; i++) { this.BodyIcon.SetLayerWeight(i, i == layerType ? 1.0f : 0.0f); } for (int i = 0; i < this.ArmBehindIcon.layerCount; i++) { this.ArmBehindIcon.SetLayerWeight(i, i == layerType ? 1.0f : 0.0f); } break; case CharacterBodyType.Legs: for (int i = 0; i < this.LegsIcon.layerCount; i++) { this.LegsIcon.SetLayerWeight(i, i == layerType ? 1.0f : 0.0f); } break; default: break; } }
/// <summary> /// Change Animator Layer Set /// </summary> public void ChangeAnimatorLayerSet(CharacterBodyType type, int layerType, bool setValue, Sprite icon) { switch (type) { case CharacterBodyType.Head: this.SelectedHeadIcon.sprite = icon; for (int i = 0; i < this.Head.layerCount; i++) { this.Head.SetLayerWeight(i, i == layerType ? 1.0f : 0.0f); } if (setValue) { this.CharacterEditPanel.CharacterConfig.HeadType = layerType; } break; case CharacterBodyType.Body: this.SelectedBodyIcon.sprite = icon; for (int i = 0; i < this.Body.layerCount; i++) { this.Body.SetLayerWeight(i, i == layerType ? 1.0f : 0.0f); } for (int i = 0; i < this.ArmBehind.layerCount; i++) { this.ArmBehind.SetLayerWeight(i, i == layerType ? 1.0f : 0.0f); } if (setValue) { this.CharacterEditPanel.CharacterConfig.BodyType = layerType; this.CharacterEditPanel.CharacterConfig.ArmBehindType = layerType; } break; case CharacterBodyType.Legs: this.SelectedLegsIcon.sprite = icon; for (int i = 0; i < this.Legs.layerCount; i++) { this.Legs.SetLayerWeight(i, i == layerType ? 1.0f : 0.0f); } if (setValue) { this.CharacterEditPanel.CharacterConfig.LegsType = layerType; } break; default: break; } for (int i = 0; i < this._CurrentObjectTabDisplays.Count; i++) { CharacterOutfitButton outfitButton = this._CurrentObjectTabDisplays[i].GetComponent <CharacterOutfitButton>(); if (outfitButton.CharacterBodyType != type) { continue; } if (outfitButton.BodyType != layerType) { outfitButton.ButtonToggle(true); } } }