using Fie.Manager; using Fie.Ponies; using Fie.User; using GameDataEditor; using System.Collections.Generic; using UnityEngine; namespace Fie.UI { public class FieGameUIPlayerWindowManager : FieGameUIComponentManagerBase { private const float SCREEN_SPLIT_NUM = 3f; private Dictionary _playerWindowList = new Dictionary(); private Dictionary _splitLineList = new Dictionary(); private Dictionary _playerLifeGaugeList = new Dictionary(); private Dictionary _playerFriendshipGaugeList = new Dictionary(); private FieGameUITargetIcon _targetIcon; private int gameCharacterCount; public override void StartUp() { ReloadPlayerWindows(); Relocate(); } public void ReloadPlayerWindows() { foreach (KeyValuePair playerWindow in _playerWindowList) { if (playerWindow.Value != null) { playerWindow.Value.uiActive = false; } } foreach (KeyValuePair playerLifeGauge in _playerLifeGaugeList) { if (playerLifeGauge.Value != null) { playerLifeGauge.Value.uiActive = false; } } foreach (KeyValuePair playerFriendshipGauge in _playerFriendshipGaugeList) { if (playerFriendshipGauge.Value != null) { playerFriendshipGauge.Value.uiActive = false; } } foreach (KeyValuePair splitLine in _splitLineList) { if (splitLine.Value != null) { splitLine.Value.uiActive = false; } } List allPlayerCharacters = FieManagerBehaviour.I.GetAllPlayerCharacters(); if (allPlayerCharacters.Count > 0) { for (int i = 0; i < allPlayerCharacters.Count; i++) { FieGameUIPlayerWindow fieGameUIPlayerWindow = FieManagerBehaviour.I.CreateGui(allPlayerCharacters[i]); FieGameUIPlayerLifeGauge fieGameUIPlayerLifeGauge = FieManagerBehaviour.I.CreateGui(allPlayerCharacters[i]); FieGameUIFriendshipGauge fieGameUIFriendshipGauge = FieManagerBehaviour.I.CreateGui(allPlayerCharacters[i]); FieGameUISplitLine fieGameUISplitLine = FieManagerBehaviour.I.CreateGui(allPlayerCharacters[i]); fieGameUIPlayerLifeGauge.isTrackingCharacterPosition = false; fieGameUIPlayerWindow.uiCamera = FieManagerBehaviour.I.uiCamera; fieGameUIPlayerLifeGauge.uiCamera = FieManagerBehaviour.I.uiCamera; fieGameUIFriendshipGauge.uiCamera = FieManagerBehaviour.I.uiCamera; fieGameUISplitLine.uiCamera = FieManagerBehaviour.I.uiCamera; fieGameUIPlayerWindow.transform.position = new Vector3(0f, 512f, 0f); fieGameUIPlayerLifeGauge.transform.position = new Vector3(0f, 512f, 0f); fieGameUIFriendshipGauge.transform.position = new Vector3(0f, 512f, 0f); fieGameUISplitLine.transform.position = new Vector3(0f, 512f, 0f); fieGameUIPlayerWindow.nameTextMesh.text = FieManagerBehaviour.I.GetUserName(i); FieUser data = FieManagerBehaviour.I.GetUserData(i); fieGameUIPlayerWindow.levelText.replaceMethod = delegate(ref string targetString) { string constantText = FieLocalizeUtility.GetConstantText(GDEItemKeys.ConstantTextList_PLAYER_WINDOW_LV_TEXT); if (data == null || data.playerInfo == null || data.playerInfo.IsLocal) { FieLevelInfo levelInfoByTotalExp = FieManagerBehaviour.I.GetLevelInfoByTotalExp(data.usersCharacter.totalExp); constantText = constantText.Replace("___Value1___", FieManagerBehaviour.I.onMemorySaveData.PlayerLevel.ToString()); constantText = constantText.Replace("___Value2___", levelInfoByTotalExp.level.ToString()); } else { constantText = constantText.Replace("___Value1___", ((int)data.playerInfo.CustomProperties["player_level"]).ToString()); constantText = constantText.Replace("___Value2___", ((int)data.playerInfo.CustomProperties["character_level"]).ToString()); } targetString = constantText; }; _playerWindowList[i] = fieGameUIPlayerWindow; _playerLifeGaugeList[i] = fieGameUIPlayerLifeGauge; _playerFriendshipGaugeList[i] = fieGameUIFriendshipGauge; _splitLineList[i] = fieGameUISplitLine; gameCharacterCount++; } } _targetIcon = FieManagerBehaviour.I.CreateGui(base.componentManagerOwner); _targetIcon.uiCamera = FieManagerBehaviour.I.uiCamera; Relocate(); } public void Relocate() { float num = (float)Screen.width; float num2 = num / 3f; float num3 = num / 6f; float num4 = num2 * 0.5f; float num5 = num3 * 2f; Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); foreach (KeyValuePair playerWindow in _playerWindowList) { if (FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.HEADER_ROOT] != null) { playerWindow.Value.transform.parent = FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.HEADER_ROOT]; } playerWindow.Value.transform.position = playerWindow.Value.uiCamera.camera.ScreenToWorldPoint(new Vector3(num4, (float)Screen.height, 0f)); num4 += num2; dictionary[playerWindow.Key] = playerWindow.Value.lifeGaugePositionTransform; dictionary2[playerWindow.Key] = playerWindow.Value.friendshipGaugePositionTransform; } foreach (KeyValuePair splitLine in _splitLineList) { if (FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.HEADER_ROOT] != null) { splitLine.Value.transform.parent = FieManagerBehaviour.I.uiPositionList[FieGUIManager.FieUIPositionTag.HEADER_ROOT]; } if (splitLine.Key >= 2) { splitLine.Value.gameObject.SetActive(value: false); } else { splitLine.Value.transform.position = splitLine.Value.uiCamera.camera.ScreenToWorldPoint(new Vector3(num5, (float)Screen.height, 0f)); num5 += num3 * 2f; } } foreach (KeyValuePair playerLifeGauge in _playerLifeGaugeList) { if (dictionary.ContainsKey(playerLifeGauge.Key)) { playerLifeGauge.Value.transform.position = dictionary[playerLifeGauge.Key].position; playerLifeGauge.Value.gameObject.transform.SetParent(dictionary[playerLifeGauge.Key]); } } foreach (KeyValuePair playerFriendshipGauge in _playerFriendshipGaugeList) { if (dictionary2.ContainsKey(playerFriendshipGauge.Key)) { playerFriendshipGauge.Value.transform.position = dictionary2[playerFriendshipGauge.Key].position; playerFriendshipGauge.Value.gameObject.transform.SetParent(dictionary2[playerFriendshipGauge.Key]); } } } public override void setComponentManagerOwner(FieGameCharacter owner) { base.setComponentManagerOwner(owner); } } }