コード例 #1
0
ファイル: CenterTable.cs プロジェクト: mucsirobert/Card_app
    // Use this for initialization
    public void Start()
    {
        if (isServer)
        {
            TableEditorDataHolder tableEditorManager = GameObject.FindGameObjectWithTag("TableEditorDataHolder").GetComponent <TableEditorDataHolder>();


            tableEditorManager.CenterTable.SpawnEntities(this.gameObject, null);
        }

        /*
         * GameObject[] zones = GameObject.FindGameObjectsWithTag("Zone");
         * List<GameSaveDataHolder.CardSaveData> tempList = GameSaveDataHolder.Instance.data.cardDataList;
         * if (tempList == null) UnityEngine.Debug.Log("templist ures");
         * if (GameSaveDataHolder.Instance == null) UnityEngine.Debug.Log("instance ures");
         * int i = 0;
         * foreach (GameObject item in zones)
         * {
         *  foreach (GameSaveDataHolder.CardSaveData carddata in tempList)
         *  {
         *      i++;
         *      UnityEngine.Debug.Log(i);
         *      UnityEngine.Debug.Log("jéj");
         *      CardView card = GameObject.Find(carddata.cardName).GetComponent<CardView>();
         *      UnityEngine.Debug.Log("jéjután");
         *      if (item.transform.position == carddata.zonePosition)
         *          item.GetComponent<Zone>().tempMethod(card);
         *  }
         * }
         */
    }
コード例 #2
0
ファイル: TablesHolder.cs プロジェクト: mucsirobert/Card_app
    // Use this for initialization
    void Start()
    {
        tableEditorDataHolder = GameObject.FindGameObjectWithTag("TableEditorDataHolder").GetComponent <TableEditorDataHolder>();


        ActiveTable = centerTable;
    }
コード例 #3
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         DestroyImmediate(gameObject);
     }
 }
コード例 #4
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            // tabledata = GameObject.FindGameObjectWithTag("TableEditorDataHolder").GetComponent<TableEditorDataHolder>();
            // players = GameObject.FindGameObjectsWithTag("Player").GetComponent<Player>();
            TableEditorDataHolder tedh = GameObject.FindGameObjectWithTag("TableEditorDataHolder").GetComponent <TableEditorDataHolder>();
            tables = tedh.getTables();


            DontDestroyOnLoad(gameObject);
        }
        else
        {
            DestroyImmediate(gameObject);
        }
    }
コード例 #5
0
    public void LoadFromJSON(string dataAsJson)
    {
        //string dataAsJson = File.ReadAllText(Path.Combine(Application.dataPath, Path.Combine("Games", listOfGames[index].Name)));
        JsonSerializerSettings settings = new JsonSerializerSettings {
            TypeNameHandling = TypeNameHandling.All
        };

        //TableEditorDataHolder.Tables tables = JsonConvert.DeserializeObject<TableEditorDataHolder.Tables>(dataAsJson, settings);
        DataSave dataa = JsonConvert.DeserializeObject <DataSave>(dataAsJson, settings);

        data = dataa;
        TableEditorDataHolder tableEditorManager = GameObject.FindGameObjectWithTag("TableEditorDataHolder").GetComponent <TableEditorDataHolder>();

        tableEditorManager.setTables(dataa.tables);


        Debug.Log("delegétmukodik");
    }
コード例 #6
0
ファイル: Player.cs プロジェクト: mucsirobert/Card_app
    void SpawnHandAndTable()
    {
        //hand.transform.localPosition.Set(0, -2.7f, 0);
        hand = Instantiate(handPrefab, this.transform);
        //hand.parent = this.gameObject;
        hand.ownerNetId = this.netId;
        hand.zoneName   = playerName + "'s hand";
        hand.zoneColor  = this.playerColor;


        NetworkServer.Spawn(hand.gameObject);
        handObject = hand.gameObject;

        Table = Instantiate(tablePrefab, this.transform);
        NetworkServer.Spawn(Table.gameObject);
        tableObject = Table.gameObject;

        TableEditorDataHolder tableEditorManager = GameObject.FindGameObjectWithTag("TableEditorDataHolder").GetComponent <TableEditorDataHolder>();

        tableEditorManager.PlayerTable.SpawnEntities(Table.gameObject, this);
    }
コード例 #7
0
    public void SaveToJSON()
    {
        string fileName = DateTime.Now.ToString("yyyy-MM-dd--HH-mm-ss") + ".txt";
        string path     = Application.dataPath;

        Debug.Log(path);

        DirectoryInfo di = new DirectoryInfo(Path.Combine(path, "Games"));

        if (!di.Exists)
        {
            di.Create();
        }

        TableEditorDataHolder tedh = GameObject.FindGameObjectWithTag("TableEditorDataHolder").GetComponent <TableEditorDataHolder>();

        tables = tedh.getTables();

        data.tables = tedh.getTables();
        data.loadCards();


        Debug.Log(Path.Combine(di.FullName, fileName));
        Debug.Log("Mentve");
        var sr = File.CreateText(Path.Combine(di.FullName, fileName));
        //sr.WriteLine(JsonUtility.ToJson(tables));
        JsonSerializerSettings settings = new JsonSerializerSettings {
            TypeNameHandling = TypeNameHandling.All
        };

        // SerializableObjects so = new SerializableObjects();
        //so.loadForSave();
        // sr.WriteLine(JsonConvert.SerializeObject(CommandProcessor.Instance.getStackToSave(), settings));
        // GameSaveDataHolder gsdh = GameObject.FindGameObjectWithTag("GameSaveDataHolder").GetComponent<GameSaveDataHolder>();
        sr.WriteLine(JsonConvert.SerializeObject(data, settings));
        sr.Close();
    }