コード例 #1
0
ファイル: CoreOptions.cs プロジェクト: NachyoChez/BookWork
    public void AddDefaultZones()
    {
        DBZone newzone = new DBZone ("Hand");
        newzone.DrawAtTheStartOfGame = 6;
        zones.Add (newzone);
        newzone = new DBZone ("Lands");
        zones.Add (newzone);
        newzone = new DBZone ("Creatures");
        zones.Add (newzone);
        newzone = new DBZone ("Graveyard");
        newzone.UseSlots = newzone.StackAllInOneSlot = true;
        zones.Add (newzone);

        foreach (DBZone zone in zones) {
                        zone.Default = true;
                        DBZone enemyzone = new DBZone(zone);
                        enemyzone.Name = "Enemy " + enemyzone.Name.ToLower();
                        enemy_zones.Add (enemyzone);
                }
        newzone = new DBZone ("Grid");
        newzone.UseSlots = true;
        newzone.PlayerCanChooseSlot = true;
        newzone.Shared = true;
        zones.Add (newzone);
    }
コード例 #2
0
ファイル: Zone.cs プロジェクト: NachyoChez/BookWork
    //copying
    public DBZone(DBZone original)
    {
        Name = original.Name;
        RotateDegrees = original.RotateDegrees;

        UseSlots = original.UseSlots;
        StackAllInOneSlot = original.StackAllInOneSlot;
        PlayerCanChooseSlot = original.PlayerCanChooseSlot;

        PlayerInvisible = original.PlayerInvisible;
        EnemyInvisible = original.EnemyInvisible;
        DrawAtTheStartOfGame = original.DrawAtTheStartOfGame;
        EnemyFaceDown = original.EnemyFaceDown;
        PlayerFaceDown = original.PlayerFaceDown;

        Default = original.Default;
        Shared = original.Shared;
    }
コード例 #3
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);
    }
コード例 #4
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;
    }
コード例 #5
0
ファイル: TCGEditor.cs プロジェクト: NachyoChez/BookWork
    public bool ViewZone(DBZone z)
    {
        if (z.Default)	GUILayout.Label ("Name: " + z.Name );
            else z.Name = EditorGUILayout.TextField("Name:", z.Name, GUILayout.MaxWidth(500));

        GUILayout.BeginHorizontal();

        z.UseSlots = EditorGUILayout.Toggle ("Uses slots:",z.UseSlots);
        if (z.UseSlots) {
                        GUILayout.Label ("Player can choose slot:");
                        z.PlayerCanChooseSlot = EditorGUILayout.Toggle (z.PlayerCanChooseSlot);
                        GUILayout.Label ("Stack all cards in one slot:");
                        z.StackAllInOneSlot = EditorGUILayout.Toggle (z.StackAllInOneSlot);
        }
        GUILayout.EndHorizontal();

        z.RotateDegrees = EditorGUILayout.FloatField ("Rotate cards, degrees:", z.RotateDegrees);

        z.DrawAtTheStartOfGame = EditorGUILayout.IntField ("Draw cards at the start of the game:", z.DrawAtTheStartOfGame);

        GUILayout.BeginHorizontal();
        z.EnemyInvisible = EditorGUILayout.Toggle ("Invisible (enemy):",z.EnemyInvisible);
        z.PlayerInvisible = EditorGUILayout.Toggle ("Invisible (player):",z.PlayerInvisible);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        z.EnemyFaceDown = EditorGUILayout.Toggle ("Face down (enemy):", z.EnemyFaceDown);

        z.PlayerFaceDown = EditorGUILayout.Toggle ("Face down (player):", z.PlayerFaceDown);
        GUILayout.EndHorizontal();

        if (!z.Default && GUILayout.Button ("Delete zone", GUILayout.Width (100)))
            return true;

        return false;
    }
コード例 #6
0
ファイル: TCGEditor.cs プロジェクト: NachyoChez/BookWork
    public void DrawZones(CoreOptions c)
    {
        if (c.zones == null) c.zones = new List<DBZone>();
        List<DBZone> zones = c.zones;

        GUILayout.BeginHorizontal("box");
        GUILayout.BeginVertical(); //1st column: list of all zones
        GUI.skin.label.fontStyle = FontStyle.Bold;
        GUILayout.Label("Zones", GUILayout.Width(90));

        if (zones.Count > 0)	//displaying the zones' table
        {
            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
            GUILayout.BeginHorizontal();

            GUILayout.Label("name",GUILayout.MinWidth(150), GUILayout.MaxWidth(300));

            GUILayout.EndHorizontal();
            GUI.skin.label.fontStyle = FontStyle.Normal;

            for (int i = 0; i < zones.Count; i++)
            {
                DBZone currentzone = zones[i];

                if (currentzone.Name!="Grid")
                    {
                        GUILayout.BeginHorizontal();
                        if (GUILayout.Button(currentzone.Name,GUILayout.MinWidth(150), GUILayout.MaxWidth(300)))  viewed_zone = currentzone;

                        if (!currentzone.Default && GUILayout.Button("Delete",GUILayout.Width(100)))
                                zones.RemoveAt(i);	//deleting
                        GUILayout.EndHorizontal();
                    }
            }

        }

        if (GUILayout.Button("new zone",GUILayout.Width(100))    )
        {	DBZone newzone = new DBZone("New zone");

            zones.Add(newzone);
            viewed_zone = zones[zones.Count-1];

            //DBZone enemyzone = new DBZone(newzone.Name);
            //c.enemy_zones.Add(enemyzone);

        }

        GUILayout.EndVertical();

        GUILayout.BeginVertical();
        GUI.skin.label.fontStyle = FontStyle.Bold;
        GUILayout.Label("Edit zone");
        GUI.skin.label.fontStyle = FontStyle.Normal;

        GUILayout.BeginVertical("box");

        if (viewed_zone != null)	//displaying the detailed info
        {

            GUILayout.BeginVertical();

            if (ViewZone(viewed_zone))
                zones.Remove(viewed_zone);	//deleting card from db

            GUILayout.EndVertical();
        }

        GUILayout.EndVertical();

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        if (currentSettings.core.UseGrid)
            {
                currentSettings.core.UseGrid = EditorGUILayout.Toggle("Use grid", currentSettings.core.UseGrid);

                rows = EditorGUILayout.IntField("rows:", rows);
                columns = EditorGUILayout.IntField("columns:", columns);
                offset = EditorGUILayout.FloatField("distance between cells:", offset);

                if (GUILayout.Button("Create hex grid",GUILayout.Width(100))    )
                    CreateHexGrid(rows, columns, offset);
            }
    }