void DrawBowControl(Rect rect) { if (thisSystemIsReady) { IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager(); if (playerDataManager.PlayerDataIsLoaded()) { //unlock, equip Rect sub_0 = GetHorizontalSubRect(rect, 0, 2); Rect sub_1 = GetHorizontalSubRect(rect, 1, 2); IBowConfigData bowConfigData = playerDataManager.GetBowConfigDataArray()[thisSelectedBowIndex]; bool isUnlocked = bowConfigData.IsUnlocked(); string lockToggleButtonText = isUnlocked ? "Lock" : "Unlock"; if (GUI.Button( sub_0, lockToggleButtonText )) { if (isUnlocked) { playerDataManager.LockBow(thisSelectedBowIndex); } else { playerDataManager.UnlockBow(thisSelectedBowIndex); } } int equippedBowIndex = playerDataManager.GetEquippedBowIndex(); if (equippedBowIndex == thisSelectedBowIndex) { GUI.Box( sub_1, "Equipped" ); } else { if (GUI.Button( sub_1, "Equip" )) { playerDataManager.SetEquippedBow(thisSelectedBowIndex); } } } else { GUI.Box( rect, "bow control\n" + "playerData not ready" ); } } }
// void IncrementBowLevelAt(int attributeIndex){ // IPlayerDataManager dataManager = playerDataManagerAdaptor.GetPlayerDataManager(); // int equippedBowIndex = dataManager.GetEquippedBowIndex(); // dataManager.IncrementBowLevel(equippedBowIndex, attributeIndex); // CalculateShootingData(); // } void ClearAllBowConfigData() { IPlayerDataManager dataManager = playerDataManagerAdaptor.GetPlayerDataManager(); IBowConfigData[] configData = dataManager.GetBowConfigDataArray(); int arrayLength = configData.Length; for (int i = 0; i < arrayLength; i++) { dataManager.ClearBowConfigData(i); } CalculateShootingData(); }
void LoadAndFeedAllPanelsWithPlayerData() { thisPlayerDataManager.SetFileIndex(0); thisPlayerDataManager.Load(); int equippedBowIndex = thisPlayerDataManager.GetEquippedBowIndex(); IBowConfigData[] configDataArray = thisPlayerDataManager.GetBowConfigDataArray(); foreach (IBowPanel bowPanel in thisBowPanels) { int bowIndex = bowPanel.GetIndex(); IBowConfigData bowConfigData = configDataArray[bowIndex]; if (!bowConfigData.IsUnlocked()) { bowPanel.Lock(instantly: true); } else { bowPanel.Unlock(instantly: true); } if (bowIndex == equippedBowIndex) { bowPanel.SetEquippedness(isEquipped: true, instantly: true); } else { bowPanel.SetEquippedness(isEquipped: false, instantly: true); } int bowLevel = bowConfigData.GetBowLevel(); bowPanel.SetBowLevel(bowLevel, instantly: false); UpdateAttributePanel(bowPanel, bowConfigData); } UpdateUnlockButtons(); }