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); }
private void Load() { var nodesDeserialized = XMLOp.Deserialize <List <Node> >("Assets/Resources/nodes.xml"); var connectionsDeserialized = XMLOp.Deserialize <List <Connection> >("Assets/Resources/connections.xml"); nodes = new List <Node>(); connections = new List <Connection>(); foreach (var nodeDeserialized in nodesDeserialized) { nodes.Add(new Node( nodeDeserialized.rect.position, nodeDeserialized.rect.width, nodeDeserialized.rect.height, nodeStyle, selectedNodeStyle, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, nodeDeserialized.inPoint.id, nodeDeserialized.outPoint.id ) ); } foreach (var connectionDeserialized in connectionsDeserialized) { var inPoint = nodes.First(n => n.inPoint.id == connectionDeserialized.inPoint.id).inPoint; var outPoint = nodes.First(n => n.outPoint.id == connectionDeserialized.outPoint.id).outPoint; connections.Add(new Connection(inPoint, outPoint, OnClickRemoveConnection)); } }
//done init public void fetch() { Char a = XMLOp.Deserialize <Char>(characterFile); Ourtexts = a.texts; Ourname = a.name; }
public void LoadSave3() //Loads Save Slot 3 { StaticLoad.saveSlot = 3; StaticLoad.loading = true; player = XMLOp.Deserialize <Player>("Save3.xml"); SceneManager.LoadScene(player.scene); }
public static GenAreaMetaData Read(IntVector3 origin) { if (!File.Exists(FilePath(origin))) { return(default(GenAreaMetaData)); } return(XMLOp.Deserialize <GenAreaMetaData>(FilePath(origin))); }
bool HasBeenNeighborProcessed(IntVector3 chunkPos) { if (File.Exists(SerializedChunk.GetMetaDataFullPath(chunkPos))) { Chunk.MetaData meta = XMLOp.Deserialize <Chunk.MetaData>(SerializedChunk.GetMetaDataFullPath(chunkPos)); return(meta.HasBeenNeighborProcessed); } return(false); }
private void Start() { string manifest = FindFile(Application.dataPath, "SceneManifest.xml", true); if (manifest != "") { sceneManifest = XMLOp.Deserialize <List <SceneInfo> >(manifest); } }
// Use this for initialization void Start() { pseudoDialogue = XMLOp.Deserialize <Dialogue>("Assets/XML/Dialogue Pseudo.xml"); // Testing //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); }
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!"); }
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"); }
// 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(); } } } }
// 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"); }
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"); }
public void xml() { XMLRobot robo = XMLOp.Deserialize <XMLRobot>("imported.xml"); if (asama == 0) { m_TurnInputValue = robo.rotationGrab1; } if (asama == 1) { m_TurnInputValue = robo.rotationDrop1; } }
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"); }
private void Load() { var nodesDeserialized = XMLOp.Deserialize <List <ENodeBase> >("Assets/Resources/nodes.xml"); var connectionsDeserialized = XMLOp.Deserialize <List <Connection> >("Assets/Resources/connections.xml"); Nodes = new List <ENodeBase>(); connections = new List <Connection>(); foreach (var node in nodesDeserialized) { if (node is ENodeDialogueOptions) { Nodes.Add(new ENodeDialogueOptions( node.rect.position, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, RemoveOptionConnections, node.inPoint.id, node.outPoint.id, ((ENodeDialogueOptions)node).outPoint01.id, ((ENodeDialogueOptions)node).outPoint02.id ) ); } else if (node is ENodeDialogueNormal) { Nodes.Add(new ENodeDialogueNormal( node.rect.position, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, node.inPoint.id, node.outPoint.id ) ); } } foreach (var connectionDeserialized in connectionsDeserialized) { var inPoint = Nodes.First(n => n.inPoint.id == connectionDeserialized.inPoint.id).inPoint; var outPoint = Nodes.First(n => n.outPoint.id == connectionDeserialized.outPoint.id).outPoint; connections.Add(new Connection(inPoint, outPoint, OnClickRemoveConnection)); } }
// Use this for initialization void Start() { pseudoDialogue = XMLOp.Deserialize <Dialogue>("Assets/XML/Dialogue Pseudo.xml"); // Deserialization testing //TestDeserialization(); // Assign dialogues to their respective characters AssignDialogues(); var progressButton = debugProgressDay.GetComponent <Button>(); progressButton.onClick.AddListener(DialogueController.Instance.ProgressDay); }
public static void SetupKeybind() { currKeybind = XMLOp.Deserialize <KeybindClass[]>(Application.dataPath + "/Resources/" + "Keybind_Save.xml"); keyBinds.Clear(); for (int i = 0; i < currKeybind.Length; i++) { if (currKeybind[i].controlName == "") { continue; } keyBinds.Add(currKeybind[i].controlName, currKeybind[i].keyCodeValue); } iskeybindAssign = true; }
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 }
//loads the song data and instantiates the song score and is ready for start to be pressed public void Load() { if (configPath == "") { configPath = UnityEditor.EditorUtility.OpenFilePanel("Select a Song config", "", ""); } Config config = XMLOp.Deserialize <Config>(configPath); SongData songData = scoreDB.songScores.Find(x => x.songTitle == config.songTitle); songClip = (AudioClip)Resources.Load("Songs/Music/" + config.songTitle, typeof(AudioClip)); song.clip = songClip; songName = songData.songTitle; songNameInput.text = songData.songTitle; GameObject go = Instantiate(songData.songScoreObject, new Vector3(0f, 2.5f, 0f), Quaternion.identity); songScore = go; songScore.SetActive(false); }
// Start is called before the first frame update void Start() { saveSlot = StaticLoad.saveSlot; if (StaticLoad.loading == true) { if (System.IO.File.Exists("Save" + saveSlot + ".xml")) { player = XMLOp.Deserialize <Player>("Save" + saveSlot + ".xml"); } else { player.name = "Jonas"; // player.hp = 100; // player.atk = 5; // player.def = 5; // player.accuracy = 1.0f; // player.efficiency = 1.0f; // Set these values to the new character defaults player.level = 1; // Vector3 playerPos = new Vector3(0f, 0f, 0f); // player.posx = playerPos.x; // player.posy = playerPos.y; // player.posz = playerPos.z; // player.scene = SceneManager.GetActiveScene().name; // } } else { player.name = "Jonas"; // player.hp = 100; // player.atk = 5; // player.def = 5; // player.accuracy = 1.0f; // player.efficiency = 1.0f; // Set these values to the new character defaults player.level = 1; // Vector3 playerPos = new Vector3(0f, 0f, 0f); // player.posx = playerPos.x; // player.posy = playerPos.y; // player.posz = playerPos.z; // player.scene = SceneManager.GetActiveScene().name; // } }
void Start() { if (System.IO.File.Exists("player.xml")) { Debug.Log("File Exists"); player = XMLOp.Deserialize <Player>("player.xml"); userName.text = player.userName; race.text = player.race; characterClass.value = player.characterClass; level.text = player.level.ToString(); health.value = player.health; } else { NPF.SetActive(true); Debug.Log("File doesn't exist"); userName.text = player.userName; race.text = player.race; characterClass.value = player.characterClass; level.text = player.level.ToString(); health.value = player.health; } }
private void Load() { var nodesDeserialized = XMLOp.Deserialize <List <DialogNode> >("Assets/Resources/nodes.xml"); var connectionsDeserialized = XMLOp.Deserialize <List <Connections> >("Assets/Resources/connections.xml"); nodes = new List <DialogNode>(); connections = new List <Connections>(); foreach (var nodeDeserialized in nodesDeserialized) { /* * nodes.Add(new DialogNode( * nodeDeserialized.rect.position, * nodeDeserialized.rect.width, * nodeDeserialized.rect.height, * nodeStyle, * selectedNodeStyle, * inPointStyle, * outPointStyle, * OnClickInPoint, * OnClickOutPoint, * nodeDeserialized.inPoint.id, * nodeDeserialized.outPoint.id, * nodeDeserialized.isRoot, * OnClickRemoveNode, * nodeDeserialized.nodeID * ) * ); */ } foreach (var connectionDeserialized in connectionsDeserialized) { var inPoint = nodes.First(n => n.inPoint.id == connectionDeserialized.inPoint.id).inPoint; var outPoint = nodes.First(n => n.outPoint.id == connectionDeserialized.outPoint.id).outPoint; connections.Add(new Connections(inPoint, outPoint, OnClickRemoveConnection)); } }
public void Load() { if (System.IO.File.Exists("player.xml")) { player = XMLOp.Deserialize <Player>("player.xml"); /// added by Brian Debug.Log(player._XPos + " " + player._YPos + " " + player._ZPos); Debug.Log(playerObj.transform.position); cc.enabled = false; playerObj.transform.position = new Vector3(player._XPos, player._YPos, player._ZPos); cc.enabled = true; /// } /* else * { * player._health = health.currentHealth; * player._oil = lantern.currentOil; * player._XPos = playerObj.transform.position.x; * player._YPos = playerObj.transform.position.y; * player._ZPos = playerObj.transform.position.z; * XMLOp.Serialize(player, "player.xml"); // for save button also * }*/ }
private void Start() { Hero hero = XMLOp.Deserialize <Hero>("hero.xml"); Debug.Log(hero.name); }
public static void CreateSceneManifest(List <SceneInfo> sceneInfoList, string manifestPath) { XMLOp.Serialize(sceneInfoList, manifestPath + "/SceneManifest.xml"); }
private void Save() { XMLOp.Serialize(Nodes, "Assets/Resources/nodes.xml"); XMLOp.Serialize(connections, "Assets/Resources/connections.xml"); }
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); }
public void SaveSlot3() { XMLOp.Serialize(player, "Save3.xml"); }