コード例 #1
0
ファイル: TCGEditor.cs プロジェクト: NachyoChez/BookWork
    void SaveTCGData()
    {
        Current.core.enemy_zones.Clear ();
        foreach (DBZone foundzone in Current.core.zones) {
                        if (!foundzone.Shared) {
                        DBZone newzone = new DBZone(foundzone);
                        newzone.Name = "Enemy " + newzone.Name.ToLower();
                        Current.core.enemy_zones.Add (newzone);
                        }
                }
        //CombatCodeGenerator.combat_rules = Current.combat;
        //CombatCodeGenerator.WriteCodeFile();

        Current.cards = cards_db.cards;

        unchangedSettings = currentSettings;

        AssetDatabase.CreateAsset(currentSettings, SettingsAssetFile); //trying to rewrite file

        currentSettings = (TCGData)Instantiate(unchangedSettings);  //we need this
        //		AddCustomStatsToCombat();
        Debug.Log("unchanged test"+unchangedSettings.test);
    }
コード例 #2
0
ファイル: TCGEditor.cs プロジェクト: NachyoChez/BookWork
    public static void ReLoadCurrentSettings()
    {
        Debug.Log ("starting to reload");
        // warns developers if there are more than one settings files in resources folders. first will be used.
        UnityEngine.Object[] settingFiles = Resources.LoadAll("TCGData", typeof(TCGData)); //finding all files with that name
        if (settingFiles != null && settingFiles.Length > 0)
        {
            Debug.Log ("found some settings");
            unchangedSettings = (TCGData)settingFiles[0];
            currentSettings = (TCGData)Instantiate(unchangedSettings);
            if (Current.cards != null)cards_db.cards = Current.cards;

            Debug.Log("current.cards count: "+  Current.cards.Count);
            if (settingFiles.Length > 1)
            {
                Debug.LogWarning("more than one settings file");
            }

        }
    }
コード例 #3
0
ファイル: TCGEditor.cs プロジェクト: NachyoChez/BookWork
    void LoadTCGData()
    {
        currentSettings = (TCGData)Instantiate(unchangedSettings); //works
        //		AddCustomStatsToCombat();
        if (currentSettings.cards != null) cards_db.cards = currentSettings.cards;
            else cards_db.cards = new List<DbCard>();

        bool found = false;

        if (viewed_zone != null) {
                        foreach (DBZone dbz in Current.core.zones) {
                                //Debug.Log("dbz name:"+dbz.Name+"viewed name:"+viewed_zone.Name);
                                if (dbz.Name == viewed_zone.Name) {
                                        found = true;
                                        viewed_zone = dbz;
                                        break;
                                }
                            }
                        if (!found)	viewed_zone = null;
                }
        cards_db.viewed_card = null;
    }