コード例 #1
0
        public void CreateNewStageFile(StageEditorData sed)
        {
            sed.editPlayerStartPosition = new Vector(0, 0);
            sed.editRespqwnEnemy        = false;

            for (int i = 0; i < 24; i++)
            {
                for (int j = 0; j < 32; j++)
                {
                    sed.editIndicateStage[i * 32 + j] = 0;
                }
            }

            sed.objectName         = new string[] { };
            sed.objectPosition     = new Vector[] { };
            sed.objectSize         = new Vector[] { };
            sed.objectZindex       = new int[] { };
            sed.objectToggleSwitch = new bool[] { };
            sed.objectTargetType   = new TargetType[] { };
            sed.objectTargetId     = new int[] { };
            sed.objectTalkID       = new int[] { };

            sed.enemyName      = new string[] { };
            sed.enemyPosition  = new Vector[] { };
            sed.enemyDirection = new bool[] { };

            sed.itemName     = new string[] { };
            sed.itemPosition = new Vector[] { };
        }
コード例 #2
0
        private void StageNewFile()
        {
            StageEditorData dataNewStage = new StageEditorData();

            MainWindow.stageEditor.CreateNewStageFile(dataNewStage);

            DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(StageEditorData));

            FileStream fs = new FileStream("Assets/json/stage/" + txbStageName.Text + ".json", FileMode.Create);

            try
            {
                json.WriteObject(fs, dataNewStage);
            }
            finally
            {
                fs.Close();
            }
        }