Exemplo n.º 1
0
        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"
                        );
                }
            }
        }