public override void OnEnable() { base.OnEnable(); if (objRender != null) { objRender.ShowObj(true); } //设置角色数据 UserDataBean userData = GameDataHandler.Instance.manager.GetUserData(); showCharacter.SetCharacterData(userData.characterData); }
/// <summary> /// 显示角色 /// </summary> public void ShowCharacter() { //先隐藏三个角色 manager.ShowCharacterObjByIndex(1, false); manager.ShowCharacterObjByIndex(2, false); manager.ShowCharacterObjByIndex(3, false); GameDataHandler.Instance.manager.GetAllUserData((listData) => { for (int i = 0; i < listData.Count; i++) { UserDataBean userData = listData[i]; GameObject objCharacter = manager.ShowCharacterObjByIndex(userData.dataIndex, true); if (objCharacter == null) { continue; } CreatureCptCharacter character = objCharacter.GetComponent <CreatureCptCharacter>(); character.SetCharacterData(userData.characterData); } }); }
/// <summary> /// 刷新角色 /// </summary> public void RefreshCharacter() { UserDataBean userData = GameDataHandler.Instance.manager.GetUserData(); character.SetCharacterData(userData.characterData); }