Exemplo n.º 1
0
    void OnMouseDown()
    {
        ApplicationState appState = ApplicationState.singleton;
        ApplicationData  data     = appState.data;

        switch (state)
        {
        case SaveButtonState.Remove:
            data.savedPlanets.Remove(solarSystem.planetParams.planetSeed);
            appState.Save();
            state = SaveButtonState.Add;
            break;

        case SaveButtonState.Add:
            data.savedPlanets.Add(solarSystem.planetParams.planetSeed);
            appState.Save();
            state = SaveButtonState.Remove;
            break;

        case SaveButtonState.SaveListFull:
            break;

        default:
            throw new ArgumentException("unrecognized enum value: " + state);
        }
        gameObject.guiText.text = TextForState(state);
    }
Exemplo n.º 2
0
 void Start()
 {
     if(ApplicationState.singleton.data.savedPlanets.Contains(solarSystem.planetParams.planetSeed)) {
         state = SaveButtonState.Remove;
     } else if (ApplicationState.singleton.data.savedPlanets.Count >= maxSaves) {
         state = SaveButtonState.SaveListFull;
     }
     gameObject.guiText.text = TextForState(state);
 }
Exemplo n.º 3
0
 String TextForState(SaveButtonState state)
 {
     switch(state) {
     case SaveButtonState.Add: return "Save";
     case SaveButtonState.Remove: return "Unsave";
     case SaveButtonState.SaveListFull: return "List Full";
     default:
         throw new ArgumentException("unrecognized enum value: " + state);
     }
 }
Exemplo n.º 4
0
 void Start()
 {
     if (ApplicationState.singleton.data.savedPlanets.Contains(solarSystem.planetParams.planetSeed))
     {
         state = SaveButtonState.Remove;
     }
     else if (ApplicationState.singleton.data.savedPlanets.Count >= maxSaves)
     {
         state = SaveButtonState.SaveListFull;
     }
     gameObject.guiText.text = TextForState(state);
 }
Exemplo n.º 5
0
    String TextForState(SaveButtonState state)
    {
        switch (state)
        {
        case SaveButtonState.Add: return("Save");

        case SaveButtonState.Remove: return("Unsave");

        case SaveButtonState.SaveListFull: return("List Full");

        default:
            throw new ArgumentException("unrecognized enum value: " + state);
        }
    }
Exemplo n.º 6
0
    void OnMouseDown()
    {
        ApplicationState appState = ApplicationState.singleton;
        ApplicationData data = appState.data;

        switch(state) {
        case SaveButtonState.Remove:
            data.savedPlanets.Remove(solarSystem.planetParams.planetSeed);
            appState.Save();
            state = SaveButtonState.Add;
            break;
        case SaveButtonState.Add:
            data.savedPlanets.Add(solarSystem.planetParams.planetSeed);
            appState.Save();
            state = SaveButtonState.Remove;
            break;
        case SaveButtonState.SaveListFull:
            break;
        default:
            throw new ArgumentException("unrecognized enum value: " + state);
        }
        gameObject.guiText.text = TextForState(state);
    }