123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- using System;
- using LitJson;
- using UnityEngine;
- using UnityEngine.EventSystems;
- using System.Xml;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- public class Initializer : MonoBehaviour
- {
- #region
- public static List<Regist> RegistList;
- #endregion
- private void Start()
- {
- StartCoroutine(IStart());
- }
- private IEnumerator IStart()
- {
- string path;
- WWW www;
- FileInfo fileInfo = new FileInfo(Application.persistentDataPath + "/PlayerConfig.xml");
- if (fileInfo.Exists)
- {
- if (Application.platform == RuntimePlatform.Android)
- {
- path = "file://" + Application.persistentDataPath + "/PlayerConfig.xml";
- }
- else
- {
- path = "file:///" + Application.persistentDataPath + "/PlayerConfig.xml";
- }
- www = new WWW(path);
- yield return www;
- }
- else
- {
- if (Application.platform == RuntimePlatform.Android)
- {
- path = Application.streamingAssetsPath + "/PlayerConfig.xml";
- }
- else
- {
- path = "file:///" + Application.streamingAssetsPath + "/PlayerConfig.xml";
- }
- www = new WWW(path);
- yield return www;
- StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
- sw.Write(www.text);
- sw.Close();
- }
- Data.PlayerDoc = new XmlDocument();
- Data.PlayerDoc.LoadXml(www.text);
- Data.PlayerNode = Data.PlayerDoc.SelectSingleNode("PlayerConfig");
- RegistList = new List<Regist>();
- gameObject.AddScript<ManaReso>();
- gameObject.AddScript<ManaAnim>();
- gameObject.AddScript<ManaAudio>();
- gameObject.AddScript<ManaUI>();
- gameObject.AddScript<ManaData>();
- gameObject.AddScript<ManaGarden>();
- gameObject.AddScript<ManaDebug>();
- gameObject.AddScript<ManaPlayer>();
- gameObject.AddScript<ManaMiniGame>();
- for (int i = 0; i < RegistList.Count; i++)
- {
- RegistList[i].RegistReference();
- }
- for (int i = 0; i < RegistList.Count; i++)
- {
- RegistList[i].RegistValueA();
- }
- for (int i = 0; i < RegistList.Count; i++)
- {
- RegistList[i].RegistValueB();
- }
- for (int i = 0; i < RegistList.Count; i++)
- {
- RegistList[i].RegistValueC();
- }
- }
- }
|