示例#1
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Data data = DataSaver.Load();
            if (data != null)
            {
                Debug.Log("--------------- String ----------------");
                foreach (var str in data.str)
                {
                    Debug.Log(str);
                }

                Debug.Log("--------------- List ----------------");
                foreach (var list in data.lists)
                {
                    foreach (var element in list)
                    {
                        Debug.Log(element);
                    }
                }

                Debug.Log("--------------- Dictionary ----------------");
                foreach (var dict in data.dictionaries)
                {
                    foreach (KeyValuePair <string, string> kvp in dict)
                    {
                        Debug.Log(kvp.Key);
                        Debug.Log(kvp.Value);
                    }
                }
            }
        }
    }
示例#2
0
        // On load
        public void OnProtoDeserializeObjectTree(ProtobufSerializer _)
        {
            if (SaveData.Load())
            {
                foreach (string slot in SlotNames)
                {
                    Armour.AddSlot(slot);

                    TechType slotItem = (TechType)SaveData.Data.GetOrDefault(slot, (int)TechType.None);

                    if (slotItem == TechType.None)
                    {
                        continue;
                    }

                    //Pickupable itemPickup = new Pickupable();
                    //itemPickup.SetTechTypeOverride(slotItem);
                    //InventoryItem item = new InventoryItem(itemPickup);

                    GameObject    itemObject     = CraftData.InstantiateFromPrefab(slotItem);
                    Pickupable    itemPickupable = itemObject.GetComponent <Pickupable>();
                    InventoryItem item           = new InventoryItem(itemPickupable);

                    Armour.AddItem(slot, item, true);
                    typeof(Pickupable).GetMethod("Deactivate", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(itemPickupable, null);
                }
            }
            else
            {
                SetSlots();
            }

            Logger.Log($"Successfully loaded items for {ID}");
        }
示例#3
0
        public void LoadCells()
        {
            List <List <int> >  jsonData       = DataSaver.Load();
            List <IGenericCell> generatedCells = GeneticCellMutation.GenerateNewCells(jsonData);

            CellField.DeleteAllElements();
            CellField.InitializeLiveCells(generatedCells);
        }
示例#4
0
 public bool Load()
 {
     data = DataSaver.Load <PlayerData>("playerData.dat");
     if (data == null)
     {
         return(false);
     }
     return(!(data == null));
 }
示例#5
0
文件: GameManager.cs 项目: MrEk0/Room
    private void LoadPlayerName()
    {
        GameData playerdata = DataSaver.Load();

        if (playerdata != null)
        {
            playerName = playerdata.name;
        }
    }
示例#6
0
    private void Start()
    {
        audioSrc = GetComponent <AudioSource>();

        ToMainMenu();

        DataSaver.Load();

        PopulateHighscoreLists();
    }
示例#7
0
    private void LoadPlayerStat()
    {
        GameData statData = DataSaver.Load();

        if (statData != null)
        {
            stat1Text.text = "Стат 1: " + statData.stat1.ToString();
            stat2Text.text = "Стат 2: " + statData.stat2.ToString();
            stat3Text.text = "Стат 3: " + statData.stat3.ToString();
        }
    }
示例#8
0
 public void Load()
 {
     if (m_DataSaver.Load(m_Path))
     {
         currentCharacter      = m_DataSaver.GetString("character");
         currentLevel          = m_DataSaver.GetString("level");
         currentDifficulty     = m_DataSaver.GetString("difficulty");
         currentMuteMusicState = m_DataSaver.GetBool("mute");
     }
     IsLoaded = true;
 }
示例#9
0
        private void ReloadCells()
        {
            List <List <int> >  jsonData       = DataSaver.Load();
            List <IGenericCell> generatedCells = GeneticCellMutation.GenerateNewCells(jsonData);

            int[,] field = DataSaver.LoadField();

            _simulationManger.DeleteAllElements();
            _simulationManger.GenerateGameField(field);
            _simulationManger.InitializeLiveCells(generatedCells);
        }
示例#10
0
        public static void LoadProgress()
        {
            if (instance == null)
            {
                return;
            }

            PlayerData progress = DataSaver.Load();

            if (progress != null)
            {
                NumberOfOpenedLevels = progress.levelProgress;
            }
            OpenNewLevels();
        }
示例#11
0
 private void ExecuteAwaitingActions()
 {
     if (clearCategory)
     {
         gameSaves.ClearSave();
         clearCategory = false;
         RefreshKeys();
     }
     if (loadCategory)
     {
         gameSaves.Load();
         loadCategory = false;
         RefreshKeys();
     }
 }
示例#12
0
        public static void LoadVolume()
        {
            PlayerData data = DataSaver.Load();

            if (data != null)
            {
                MusicVolume = data.musicVolume;
                SoundVolume = data.soundVolume;

                SetMusicVolume(MusicVolume);
                SetSoundVolume(SoundVolume);

                onVolumeChanged(MusicVolume, SoundVolume);
            }
        }
示例#13
0
        public static T Load <T>() where T : new()
        {
            var filename = Constants.SettingName + ".dat";
            var saver    = new DataSaver <T>();
            var config   = new T();

            if (!File.Exists(filename))
            {
                saver.Save(filename, config);
            }
            else
            {
                config = saver.Load(filename);
            }

            return(config);
        }
示例#14
0
        public void LoadCells()
        {
            List <List <int> >  jsonData       = DataSaver.Load();
            List <IGenericCell> generatedCells = GeneticCellMutation.GenerateNewCells(jsonData);
            var field = DataSaver.LoadField();

            if (field == null)
            {
                CellField.DeleteAllElements();
            }
            else
            {
                CellField.DeleteAllElements(field);
            }

            CellField.InitializeLiveCells(generatedCells);
        }
示例#15
0
 public static T Load <T>(this T data) where T : ISaveble
 {
     return(DataSaver.Load <T>());
 }
示例#16
0
 void OnDisable()
 {
     LoadButton.onClick.RemoveListener(delegate { DestroyExisting(); });
     SaveButton.onClick.RemoveListener(delegate { SaveIfExist(); });
     LoadButton.onClick.RemoveListener(delegate { DataSaver.Load(DataPath); });
 }