示例#1
0
        async Task ProcessSet(NeighborChunkGenData neis, Action <IntVector3> OnWroteChunkData)
        {
            //TODO: trade data, etc...
            for (int i = 0; i < ChunkGenData.LODLevels; ++i)
            {
                var cullJob = await CullHidden(neis, i);

                updateChunkCenterDisplay(cullJob, neis.centerChunkData, i);
                cullJob.DisposeAll();
            }

            await localLight.CalculateLocalLight(neis);

            // write center chunk
            var wroteAtPos = neis.center;

            //
            // TODO: write chunk at some other juncture
            //
            //var wroteAtPos = await SerializedChunkGenData.WriteAsync(neis.centerChunkData, SerializedChunkGenData.GenDataFullPath(neis.center));

            // write center chunk display arrays
            SerializedChunk.SerializedDisplayBuffers.WriteLODArrays(neis.centerChunkData.displays, neis.center);

            Chunk.MetaData metaData = new Chunk.MetaData();
            metaData.LODBufferLengths         = neis.centerChunkData.displays.getLengths();
            metaData.HasBeenNeighborProcessed = true;
            XMLOp.Serialize(metaData, SerializedChunk.GetMetaDataFullPath(neis.center));

            OnWroteChunkData(wroteAtPos);
        }
示例#2
0
            public static void Write(ChunkGenData chunkGenData)
            {
                MetaData metaData = new MetaData
                {
                    LODBufferLengths         = chunkGenData.displays.getLengths(),
                    HasBeenNeighborProcessed = true
                };

                XMLOp.Serialize(metaData, SerializedChunk.GetMetaDataFullPath(chunkGenData.chunkPos));
            }
    public void SaveTheKeybind() //Update UI to Game & Script
    {
        #region Old Code
        //KeybindController.keyBinds.Clear();
        //for (int i = 0; i < keybindScript.numOfControl.Length; i++)
        //{
        //    if (keybindScript.numOfControl[i] == "") continue;
        //    KeybindController.keyBinds.Add(keybindScript.numOfControl[i], keybindScript.numOfInput[i]);

        //}
        #endregion
        keybindScript = GetComponent <KeybindController>();

        if (savingKeybind == null || savingKeybind.Length != keybindScript.numOfControl.Length)
        {
            savingKeybind = new KeybindClass[keybindScript.numOfControl.Length];
        }
        if (savingKeybind[0] == null)
        {
            for (int i = 0; i < savingKeybind.Length; i++)
            {
                savingKeybind[i]              = new KeybindClass();
                savingKeybind[i].controlName  = "null";
                savingKeybind[i].keyCodeValue = KeyCode.None;
            }
        }
        else
        {
            Debug.Log("savingKeybind exists");
        }

        controlUICount  = keybindScript.col1.transform.childCount;
        controlUICount2 = keybindScript.col2.transform.childCount;

        for (int i = 0; i < controlUICount; i++)
        {
            savingKeybind[i].controlName  = keybindScript.col1.transform.GetChild(i).GetComponent <Text>().text;
            savingKeybind[i].keyCodeValue = (KeyCode)System.Enum.Parse(typeof(KeyCode), keybindScript.col1.transform.GetChild(i).GetChild(1).GetComponent <Text>().text);
        }
        for (int i = 0; i < controlUICount2; i++)
        {
            savingKeybind[i + controlUICount].controlName  = keybindScript.col2.transform.GetChild(i).GetComponent <Text>().text;
            savingKeybind[i + controlUICount].keyCodeValue = (KeyCode)System.Enum.Parse(typeof(KeyCode), keybindScript.col2.transform.GetChild(i).GetChild(1).GetComponent <Text>().text);
        }

        //KeybindClass fuckyou = new KeybindClass();
        //fuckyou.controlName = "lick up";
        //fuckyou.keyCodeValue = KeyCode.A;
        string rPath = Application.dataPath + "/Resources/";
        XMLOp.Serialize(savingKeybind, rPath + "Keybind_Save.xml");
        GlobalSettings.SetupKeybind();

        Debug.Log("Keybind XML is Updated!");
    }
示例#4
0
    public static void CreateSceneManifest(List <string> folderNames, string manifestPath)
    {
        List <SceneInfo> sceneInfoList = new List <SceneInfo>();

        for (int i = 0; i < folderNames.Count; i++)
        {
            //Debug.Log(folderNames[i]);
            sceneInfoList.Add(new SceneInfo(i + 1, folderNames[i], false));
        }

        XMLOp.Serialize(sceneInfoList, manifestPath + "/SceneManifest.xml");
    }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit) && hit.collider.tag == "gridElement")
        {
            this.transform.position = hit.collider.transform.position;
            lastHit = hit.collider.gameObject.GetComponent <gridElement>();
            this.rectTransform.sizeDelta = new Vector2(1.0f, lastHit.GetElementHeight());
            if (Input.GetMouseButtonDown(1))
            {
                SetCurserButton(0);
            }
        }



        // reset when press 5
        //read a file, instantiate a constructor by width height. then read an array to enable and disable gridElement.
        if (Input.GetKeyDown("5"))
        {
            constructor.instance.freeMemory();
            constructor.instance.initialize(10, 2);
        }
        //save file
        if (Input.GetKeyDown("1"))
        {
            XMLOp.Serialize(constructor.instance.info, "constructorInfo.xml");
        }
        if (Input.GetKeyDown("2"))
        {
            constructorInfo outInfo = new constructorInfo();
            outInfo = XMLOp.Deserialize <constructorInfo>("constructorInfo.xml");
            constructor.instance.info.width  = outInfo.width;
            constructor.instance.info.height = outInfo.height;

            constructor.instance.freeMemory();
            constructor.instance.initialize(outInfo.width, outInfo.height);
            for (int i = 0; i < outInfo.width * outInfo.width * outInfo.height; i++)
            {
                if (outInfo.gridElementStatus[i] == 0)
                {
                    Debug.Log(i);
                    constructor.instance.info.gridElementStatus[i] = 0;
                    constructor.instance.gridElements[i].SetDisable();
                }
                else
                {
                    constructor.instance.info.gridElementStatus[i] = 1;
                    constructor.instance.gridElements[i].SetEnable();
                }
            }
        }
    }
示例#6
0
    // Update is called once per frame
    public void Save()
    {
        Debug.Log("Saving...");
        player.userName       = userName.text;
        player.race           = race.text;
        player.characterClass = characterClass.value;
        player.level          = int.Parse(level.text);
        player.health         = health.value;

        XMLOp.Serialize(player, "Player.xml");
        Debug.Log("Saved");
    }
示例#7
0
    private void Start()
    {
        Hero knight = new Hero();

        knight.name         = "Knight of Solamnia";
        knight.hitPoints    = 100;
        knight.baseDamage   = 50f;
        knight.isBoss       = true;
        knight.comboRewards = new int[] { 1, 3, 5 };

        XMLOp.Serialize(knight, "hero.xml");
    }
示例#8
0
    public void Save()     //sets the asset path of the prefab for the song score
    {
        string scorePath = Application.dataPath + "/Resources/Songs/SongScores/" + songName + "_Score.prefab";

        //checks if that file exists, if it does delete the old one
        if (File.Exists(scorePath))
        {
            File.Delete(scorePath);
        }
        //creates a prefab of the song score
        GameObject prefab = PrefabUtility.SaveAsPrefabAsset(songScore, scorePath);
        //sets a new song entry for the scriptable object database
        SongData data = new SongData(songName, prefab);
        //checks if the song is in the database already
        bool doesNotExist = true;

        foreach (SongData song in scoreDB.songScores)
        {
            if (song.songTitle == data.songTitle)
            {
                doesNotExist = false;
            }
        }
        //if it doesn't exist just add it
        if (doesNotExist)
        {
            Debug.Log("doesn't exist");
            scoreDB.songScores.Add(data);
        }
        else
        {
            Debug.Log("Exists");
            // this means it does exist
            //finds the entry
            SongData exist = scoreDB.songScores.Find(x => x.songTitle == data.songTitle);
            //removes the entry
            scoreDB.songScores.Remove(exist);
            //addes a new entry
            scoreDB.songScores.Add(data);
        }
        // sets the path to the config file and checks if it exists, if it does it deletes the old one
        string configPath = Application.dataPath + "/Resources/Songs/LoadThese/" + songName + "_Config.XML";

        if (File.Exists(configPath))
        {
            File.Delete(configPath);
        }
        //saves the config file as XML
        XMLOp.Serialize(new Config(songName, scorePath), configPath);
        Debug.Log("Saved");
    }
示例#9
0
    void Activation()
    {
        health.currentHealth = fullHealth;          //health goes to full health
        lantern.currentOil   = fullOil;             //oil goes to full oil


        player._health = health.currentHealth;
        player._oil    = lantern.currentOil;


        player._XPos = playerObj.transform.position.x;          //getting position of player
        player._YPos = playerObj.transform.position.y;
        player._ZPos = playerObj.transform.position.z;

        XMLOp.Serialize(player, "player.xml");          //saving health, oil, and player position
    }
示例#10
0
 private void Save()
 {
     XMLOp.Serialize(Nodes, "Assets/Resources/nodes.xml");
     XMLOp.Serialize(connections, "Assets/Resources/connections.xml");
 }
示例#11
0
 public void SaveSlot3()
 {
     XMLOp.Serialize(player, "Save3.xml");
 }
示例#12
0
 void TestDeserialization()
 {
     XMLOp.Serialize(pseudoDialogue, "Assets/XML/dialogue.xml");
     Debug.Log(pseudoDialogue.conversation[0].dialogueChains[1].dialogueOptions[0].textOptions[0].dialogueText[0].text);
     Debug.Log(pseudoDialogue.conversation[0].dialogueChains[1].dialogueOptions[1].textOptions[0].dialogueText[0].text);
 }
示例#13
0
 public static void CreateSceneManifest(List <SceneInfo> sceneInfoList, string manifestPath)
 {
     XMLOp.Serialize(sceneInfoList, manifestPath + "/SceneManifest.xml");
 }
示例#14
0
 public static void Write(GenAreaMetaData gamd, IntVector3 origin)
 {
     XMLOp.Serialize(gamd, FilePath(origin));
 }