Esempio n. 1
0
            public override void OnUpdate()
            {
                if (Instance.HasUpdatedSinceLastClose)
                {
                    return;
                }
                Instance.HasUpdatedSinceLastClose = true;

                ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element;

                elementAsType.ClearButtons();

                string directoryPath = Engine_Universal.CurrentPlayerDataDirectory + "Save/";

                string[] files = Directory.GetFiles(directoryPath, "*" + Engine_Universal.SaveExtension);

                for (int i = 0; i < files.Length; i++)
                {
                    string          file                = files[i];
                    string          saveName            = Path.GetFileNameWithoutExtension(file);
                    bLoadGameButton newButtonController = new bLoadGameButton(saveName);
                    Vector2         offset;
                    offset.x = 0;
                    offset.y = i * elementAsType.ButtonHeight;
                    Vector2 size;
                    size.x = elementAsType.ButtonWidth;
                    size.y = elementAsType.ButtonHeight;
                    elementAsType.AddButton(newButtonController, size, offset);
                }

                elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared();
            }
            private static void AddLoadButton(ArcenUI_ButtonSet elementAsType, SaveGameData saveGame, Vector2 offset, Vector2 size)
            {
                //Note we use a slightly different sized button for Load games as opposed to Campaign games
                //so we set the size elsewhere. We need to set the size earlier so we can correctly
                //know the changed button size when laying out the grid of games on screen
                bLoadGameButton newButtonController = new bLoadGameButton(saveGame);

                elementAsType.AddButton(newButtonController, size, offset);
            }