Ejemplo n.º 1
0
    public LevelData(string pathToJson)
    {
        jsonFile = Resources.Load(pathToJson) as TextAsset;

        platforms = new List<PlatformData> ();
        IDictionary dictionary = (IDictionary) Json.Deserialize (jsonFile.ToString());
        RXDebug.Log ("this is the json file: "+jsonFile.ToString());
        IList platform_list = (IList) dictionary ["Platforms"];
        setPlatformData (platform_list);
    }
Ejemplo n.º 2
0
    public void splitTheStrings(TextAsset theJourney)
    {
        string[] splitStrings = theJourney.ToString().Split(new string[]{"\r\n"}, StringSplitOptions.RemoveEmptyEntries);

        //INITIALIZE ALL THE LISTS
        int temp = splitStrings.Length;
        Debug.Log(temp);
        notes = new string[temp];
        index = new int[temp];
        killQuests = new string[temp];
        killOptionals = new string[temp];
        fetchQuests = new string[temp];
        lootQuests = new string[temp];
        payQuests = new string[temp];
        readQiests = new string[temp];

        for(int i=1; i< splitStrings.Length; i++) // Skip the title row
        {
            string[] columns = splitStrings[i].Split(new string[]{","}, StringSplitOptions.None);

            //EACH COLUMN GETS PULLED INTO A DIFFERENT LIST
            notes[i] = columns[0];
            index[i] = int.Parse(columns[1]);
            killQuests[i] = columns[2];
            killOptionals[i] = columns[3];
            fetchQuests[i] = columns[4];
            lootQuests[i] = columns[5];
            payQuests[i] = columns[6];
            readQiests[i] = columns[7];
        }
    }
Ejemplo n.º 3
0
	Vector2[] animation_scale;		// dim.x/dim.y
	
	// Constructor
	public SpriteSheet(Material mat, TextAsset data) {
		material = mat;
				// Create an instance of StreamReader to read from a file.
		string lines = data.ToString();
		string[] line = lines.Split("\n"[0]);
		int curLine = 0;
		
		// Read and display lines from the file until the end of the file is reached.
		animation_names = line[curLine].Split(","[0]);
		
		curLine++;
		animation_frames = ssTools.stringToVector2(line[curLine].Split("-"[0]));
		
		curLine++;
		animation_fps = ssTools.stringToFloat(line[curLine].Split(","[0]));
		
		// Wrap mode
		curLine++;
		animation_wrap_mode = ssTools.stringToInt(line[curLine].Split(","[0]));
		
		curLine++;
		animation_play_on_wake = ssTools.stringToBool(line[curLine].Split(","[0]));

		curLine++;
		animation_offset = ssTools.stringToVector2(line[curLine].Split("-"[0]));			
		
		// Get xScale and yScale values
		curLine++;
		animation_scale = ssTools.stringToVector2(line[curLine].Split("-"[0]));
		
		// Get image pixel dimensions.  Used for scaling mesh at runtime.
		curLine++;
		animation_dimensions = ssTools.stringToVector2(line[curLine].Split("-"[0]));

	}
Ejemplo n.º 4
0
 public void sendText(TextAsset incoming) {
     GetComponent<Text>().text = "";
     textAsset = incoming;
     chars = textAsset.ToString().ToCharArray();
     max = chars.Length;
     counter = 0;
     lastLetter = false;
 }
Ejemplo n.º 5
0
    public static Wedding LoadFromResources(UnityEngine.TextAsset xmlFile)
    {
        XmlSerializer serializer = new XmlSerializer(typeof(Wedding));
        StringReader  reader     = new StringReader(xmlFile.ToString());
        Wedding       wedding    = serializer.Deserialize(reader) as Wedding;

        reader.Close();

        return(wedding);
    }
Ejemplo n.º 6
0
    void Awake()
    {
        databattle = Resources.Load("data_battle") as TextAsset;
        Debug.Log(databattle);

        lstCharater = new Dictionary<int, GameObject>();

        JObject data= JObject.Parse(databattle.ToString());

        startdata = JsonConvert.DeserializeObject<ThuocTinh[]>(data["data"]["startData"].ToString());
        stepdata = JsonConvert.DeserializeObject<StepData[]>(data["data"]["stepData"].ToString());
    }
Ejemplo n.º 7
0
 static new public int ToString(IntPtr l)
 {
     try {
         UnityEngine.TextAsset self = (UnityEngine.TextAsset)checkSelf(l);
         var ret = self.ToString();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 8
0
    public static List<pointOfSail> Parse(TextAsset csvString)
    {
        //get the array of lines
        List<pointOfSail> arrayPointOfSail = new List<pointOfSail>();
        string[] arrayOfLines = csvString.ToString().Split ("\n" [0]);

        //take each line, split by comma, and then populate list at that index
        for (int i=0; i<arrayOfLines.Length; i++) {
            string[] arrayOfStrings = arrayOfLines[i].Split(","[0]);
            pointOfSail tempPOS =  new pointOfSail(arrayOfStrings[0],float.Parse(arrayOfStrings[1]));
            arrayPointOfSail.Add(tempPOS);
        }
        return arrayPointOfSail;
    }
 static int QPYX_ToString_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         UnityEngine.TextAsset QPYX_obj_YXQP = (UnityEngine.TextAsset)ToLua.CheckObject <UnityEngine.TextAsset>(L_YXQP, 1);
         string QPYX_o_YXQP = QPYX_obj_YXQP.ToString();
         LuaDLL.lua_pushstring(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int ToString(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.TextAsset obj = (UnityEngine.TextAsset)ToLua.CheckObject(L, 1, typeof(UnityEngine.TextAsset));
         string o = obj.ToString();
         LuaDLL.lua_pushstring(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 11
0
    public List<List<string>> Parse(TextAsset csvString)
    {
        //get the array of lines
        string[] arrayOfLines = csvString.ToString().Split ("\n" [0]);

        //take each line, split by comma, and then populate list at that index
        for (int i=0; i<arrayOfLines.Length; i++) {
            string[] arrayOfStrings = arrayOfLines[i].Split(","[0]);
            listOfStrings.Add (new List<string>());
            for (int j=0; j<arrayOfStrings.Length; j++){
                string temp = arrayOfStrings[j].Replace('|',',');

                listOfStrings[i].Add (temp);
            }
        }
        return listOfStrings;
    }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        file = Resources.Load ("Puzzle") as TextAsset;
        //This is the file to be used.
        //if you want to use your own file. Right now you have to open it in unity
        //and put the file in the resources folder and change its name to Puzzle
        //MUST BE A .TXT FILE

                stringArray = file.ToString ().Split ("\n" [0]);

                //sr = new StreamReader (Resources.Load ("Puzzle"));

                setup ();
                zones.Add (zone1);
                zones.Add (zone2);
                zones.Add (zone3);
                zones.Add (zone4);
                zones.Add (zone5);
                zones.Add (zone6);
                zones.Add (zone7);
                zones.Add (zone8);
                zones.Add (zone9);
    }
Ejemplo n.º 13
0
	void changeState() {	
		//update textAsset object and set text object
		curText = Resources.Load(myState.ToString()) as TextAsset;
		text.text = curText.ToString();
	}
Ejemplo n.º 14
0
 private static void ParseJSON(TextAsset json)
 {
     ParseJSONString(json.ToString());
 }
Ejemplo n.º 15
0
        private static void LoadLanguageFile(string languageId, TextAsset asset = null)
        {
            // load json file from Resources folder
			if (asset == null)
				asset = Resources.Load(dataDirectory + "text_" + languageId) as TextAsset;

            // parse language data
            if (asset != null)
            {
                Dictionary<string, string> languageData = _data[languageId];

                JSONObject data = JSONObject.Parse(asset.ToString());
                foreach (var item in data)
                {
                    languageData[item.Key] = item.Value.Str;
                }
            }
        }
Ejemplo n.º 16
0
		private static void LoadConfigFile(TextAsset asset = null)
        {
            // load config from Resources folder
			if (asset == null)
            asset = Resources.Load(dataDirectory + "languages") as TextAsset;

            // parse config file
            if (asset != null)
            {
                JSONObject data = JSONObject.Parse(asset.ToString());
                foreach (var item in data)
                {
                    if (item.Key == "languages")
                    {
                        var languageList = item.Value.Array;
                        foreach (var languageName in languageList)
                        {
                            AddLanguage(languageName.Str);
                        }
                    }
                    else if (item.Key == "standard")
                    {
                        _standardLanguage = item.Value.Str;
                    }
                }
            }
        }