private void VMInit(MCharacter mCharacter) { icon.BindingContext = mCharacter.ViewModel; icon.UpdateView(); vBattleCharacterPreview.BindingContext = mCharacter.ViewModel; vBattleCharacterPreview.UpdateView(); }
private void SetCharacter(MContent mContent) { MCharacter character = new MCharacter(); character.CharacterId = mContent.content_id; character.Level = 0; vCharacterIcon.gameObject.SetActive(true); vCharacterIcon.BindingContext = character.ViewModel; vCharacterIcon.UpdateView(); ContentName = character.Master.name; }
private void ToSelectCharacter(int characterId, bool isSelected) { if (isSelected) { App.Model.MCharacter character = System.Array.Find(App.Util.Global.SUser.self.characters, _ => _.CharacterId == characterId); GameObject shadowObj = Instantiate(selectShadow); shadowObj.SetActive(true); shadowObj.transform.SetParent(selectCharacterContent); shadowObj.transform.localScale = Vector3.one; GameObject obj = Instantiate(characterIcon); obj.transform.SetParent(shadowObj.transform); //obj.transform.localScale = Vector3.one * 0.65f; obj.transform.localScale = Vector3.one; VCharacterIcon vCharacterIcon = obj.GetComponent <VCharacterIcon>(); vCharacterIcon.BindingContext = character.ViewModel; vCharacterIcon.UpdateView(); } else { VCharacterIcon[] icons = selectCharacterContent.GetComponentsInChildren <VCharacterIcon>(); VCharacterIcon icon = System.Array.Find(icons, _ => _.ViewModel.CharacterId.Value == characterId); GameObject.Destroy(icon.transform.parent.gameObject); } }