示例#1
0
    public static void Read()
    {
        bool newFile = false;

        DialogDataList dataList = null;

        UnityEngine.Object oldFile = AssetDatabase.LoadAssetAtPath(outFileName, typeof(DialogDataList));
        if (oldFile == null)
        {
            newFile  = true;
            dataList = ScriptableObject.CreateInstance(typeof(DialogDataList)) as DialogDataList;
        }
        else
        {
            dataList = oldFile as DialogDataList;
        }

        dataList.dataList.Clear();

        string jsonStr = File.ReadAllText(fileName);

        JsonHashtable ht = FCJson.jsonDecode(jsonStr) as JsonHashtable;

        foreach (System.Object obj in ht.ValueList)
        {
            Hashtable ht2 = obj as Hashtable;

            DialogData dd = new DialogData();

            dd.id         = ht2["id"] as string;
            dd.pos        = (EnumDialogPos)(int)ht2["pos"];
            dd.speakerIDS = ht2["speaker"] as string;
            dd.contentIDS = ht2["content"] as string;

            dataList.dataList.Add(dd);
        }

        if (newFile)
        {
            AssetDatabase.CreateAsset(dataList, outFileName);
        }
        else
        {
            EditorUtility.SetDirty(dataList);
        }
        Debug.Log(string.Format("Dialogs imported OK. {0} records.", dataList.dataList.Count));
    }
示例#2
0
文件: SRC.cs 项目: 7474/SRC
        public SRC(ILoggerFactory loggerFactory)
        {
            Log = loggerFactory.CreateLogger("SRCCore");

            Help              = new Help(this);
            Event             = new Event(this);
            Expression        = new Expression(this);
            Map               = new Map(this);
            Commands          = new Commands.Command(this);
            Sound             = new Sound(this);
            Effect            = new Effect(this);
            COM               = new COM(this);
            InterMission      = new InterMission(this);
            FileHandleManager = new FileHandleManager();

            PDList  = new PilotDataList(this);
            NPDList = new NonPilotDataList(this);
            UDList  = new UnitDataList(this);
            IDList  = new ItemDataList(this);
            MDList  = new MessageDataList(this);
            EDList  = new MessageDataList(this);
            ADList  = new MessageDataList(this);
            EADList = new MessageDataList(this);
            DDList  = new DialogDataList(this);
            SPDList = new SpecialPowerDataList(this);
            ALDList = new AliasDataList(this);
            TDList  = new TerrainDataList(this);
            BCList  = new BattleConfigDataList(this);

            PList = new Pilots.Pilots(this);
            UList = new Units.Units(this);
            IList = new Items.Items(this);

            // XXX 別な実装をするならコンストラクタでは設定しない
            SystemConfig = new LocalFileConfig();
        }