protected void Initialize()
    {
        state = SavedGameStateType.None;

        GameData.Load();
        PlayerProfile.Load();

        bool isDeleteEnabled = false;

        //foreach (GameDataSlot.DataSlot slot in GameDataSlot.current.dataSlots)
        for (int i = 0; i < GameData.current.dataSlots.Length; i++)
        {
            var slot = GameData.current.dataSlots[i];

            var slotButton = gameDataSlots[i];
            var slotLabel = UIHelper.GetButtonLabel(slotButton);
            var avatarSprite = avatarSlots[i];

            if (slot.isEmpty)
            {
                slotLabel.text = "Empty";
                avatarSprite.spriteName = "transparent box";
            }
            else
            {
                var profile = PlayerProfile.current.profiles[slot.currentPlayerIndex];

                slotLabel.text = profile.Name;
                avatarSprite.spriteName = profile.Avatar;
                isDeleteEnabled = true;
            }
        }

        deleteButton.gameObject.SetActive(isDeleteEnabled);
    }
Ejemplo n.º 2
0
    protected void Initialize()
    {
        state = SavedGameStateType.None;

        GameData.Load();
        PlayerProfile.Load();

        bool isDeleteEnabled = false;

        //foreach (GameDataSlot.DataSlot slot in GameDataSlot.current.dataSlots)
        for (int i = 0; i < GameData.current.dataSlots.Length; i++)
        {
            var slot = GameData.current.dataSlots[i];

            var slotButton   = gameDataSlots[i];
            var slotLabel    = UIHelper.GetButtonLabel(slotButton);
            var avatarSprite = avatarSlots[i];

            if (slot.isEmpty)
            {
                slotLabel.text          = "Empty";
                avatarSprite.spriteName = "transparent box";
            }
            else
            {
                var profile = PlayerProfile.current.profiles[slot.currentPlayerIndex];

                slotLabel.text          = profile.Name;
                avatarSprite.spriteName = profile.Avatar;
                isDeleteEnabled         = true;
            }
        }

        deleteButton.gameObject.SetActive(isDeleteEnabled);
    }
Ejemplo n.º 3
0
    protected void OnContinueGame(UIButtonPassivePlayAnimation btn)
    {
        if (isCurrentSavedDataEmtpy() == false && state == SavedGameStateType.None)
        {
            Debug.Log("continue game");

            btn.Play();
            state = SavedGameStateType.ContinueGame;
        }
    }
Ejemplo n.º 4
0
 protected void OnNewGame(UIButtonPassivePlayAnimation btn)
 {
     if (isCurrentSavedDataEmtpy() && state == SavedGameStateType.None)
     {
         int selectedIndex = GetSelectedButtonIndex();
         GameData.current.NewGame(selectedIndex);
         GameData.Save();
         Debug.Log("new game");
         btn.Play();
         state = SavedGameStateType.NewGame;
     }
 }
    protected void OnContinueGame(UIButtonPassivePlayAnimation btn)
    {
        if (isCurrentSavedDataEmtpy() == false && state == SavedGameStateType.None)
        {
            Debug.Log("continue game");

            btn.Play();
            state = SavedGameStateType.ContinueGame;
        }
    }
 protected void OnNewGame(UIButtonPassivePlayAnimation btn)
 {
     if (isCurrentSavedDataEmtpy() && state == SavedGameStateType.None)
     {
         int selectedIndex = GetSelectedButtonIndex();
         GameData.current.NewGame(selectedIndex);
         GameData.Save();
         Debug.Log("new game");
         btn.Play();
         state = SavedGameStateType.NewGame;
     }
 }