Exemple #1
0
        public frmLevelExpEditor()
        {
            InitializeComponent();

            // Load the char names
            for (int i = 0; i < pcharnames.Length; i++)
            {
                pcharnames[i] = TextPCharNames.GetName(i);
            }

            // Draw the level stuff
            for (int i = 0; i < 10; i++)
            {
                var l = new Label();

                l.AutoSize = true;
                l.Left     = 12;
                l.Top      = cboLevelRange.Top + ((i + 1) * 27) + 2;

                this.Controls.Add(l);
                lblLevel[i] = l;

                var t = new TextBox();

                t.Left  = cboLevelRange.Left;
                t.Top   = l.Top - 2;
                t.Width = 96;

                this.Controls.Add(t);
                txtLevel[i] = t;
            }

            // Load the data
            LevelExpData.Init();
            Helpers.CheckFont(cboChar);

            loading = true;

            for (int i = 0; i < 9; i++)
            {
                cboLevelRange.Items.Add("Levels " + ((i * 10) + 1).ToString() +
                                        " to " + ((i + 1) * 10).ToString());
            }
            cboLevelRange.Items.Add("Levels 91 to 99");
            cboLevelRange.SelectedIndex = 0;

            for (int i = 0; i < 16; i++)
            {
                cboChar.Items.Add("[" + i.ToString("X2") + "] " + pcharnames[i]);
            }

            loading = false;

            cboChar.SelectedIndex = 0;
        }
Exemple #2
0
    /// <summary>
    /// Load this LevelExpStore from a JSON file on disk.
    /// </summary>
    public void Load()
    {
        path = Path.Combine(Application.persistentDataPath, folderName);
        path = Path.Combine(path, filename);

        if (File.Exists(path))
        {
            using (StreamReader streamReader = File.OpenText(path))
            {
                string       jsonString = streamReader.ReadToEnd();
                LevelExpData loadedData =
                    JsonUtility.FromJson <LevelExpData>(jsonString);
                data = loadedData;
            }
        }
        else
        {
            // There is no previous file so this new character starts at level
            // one.
            data = LevelExpData.CreateLevelOne();
        }
    }
Exemple #3
0
 /// <summary>
 /// Reset this LevelExpStore's LevelExpData so that it can be used to
 /// reference a different file on disk.
 /// </summary>
 private void Reset()
 {
     data = LevelExpData.CreateEmpty();
 }