Пример #1
0
    public void onUserConnected(List <string> names)
    {
        for (int i = 0; i < names.Count; i++)
        {
            list[i].gameObject.SetActive(true);
            list[i].nameText.text = names[i];
            Debug.Log(names[i]);
            if (names[i] == playerTemp.playerName)
            {
                curPlayer = list[i];
                //button0.gameObject.SetActive(true);
            }
        }

        if (names.Count == 2)
        {
            for (int i = 0; i < names.Count; i++)
            {
                if (names[i] != playerTemp.playerName)
                {
                    GameObject player = Instantiate(playerPrefab, new Vector3(), Quaternion.identity);
                    player.name = player.GetComponent <Player>().playerName = names[i];
                    DontDestroyOnLoadManager.DontDestroyOnLoad(player);
                }
            }
            Debug.Log("beres");
            StartCoroutine(gameStart());
        }
    }
Пример #2
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }
        GameEvents.SaveInitiated += Save;
        GameEvents.LoadInitiated += Load;

        gameObject.transform.parent = null;
        //DontDestroyOnLoad(gameObject);
        DontDestroyOnLoadManager.DontDestroyOnLoad(gameObject);

        /* if (instance != null)
         * {
         *   Debug.LogWarning("More than one instance of inventory");
         *   return;
         * }
         *
         * instance = this;*/
    }
Пример #3
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        gameObject.transform.parent = null;
        //DontDestroyOnLoad(gameObject);
        DontDestroyOnLoadManager.DontDestroyOnLoad(gameObject);

        foreach (Sound s in sounds)
        {
            s.source = gameObject.AddComponent <AudioSource>();

            s.source.clip = s.clip;

            s.source.volume      = s.volume;
            s.source.pitch       = s.pitch;
            s.source.playOnAwake = s.playOnAwake;
            s.source.loop        = s.loop;
        }
    }
Пример #4
0
 void Start()
 {
     if (DontDestroyOnLoadManager.Objects.Count == 0)
     {
         GameObject creation = Instantiate(prefab) as GameObject;
         DontDestroyOnLoadManager.DontDestroyOnLoad(creation);
     }
     else if (DontDestroyOnLoadManager.Objects.Count > 1)
     {
         DontDestroyOnLoadManager.DestroyAll();
         Debug.LogError("FATAL ERROR : 뭔가 이상해!!");
         return;
     }
 }
Пример #5
0
    void Awake()
    {
        int GameStatusCount = FindObjectsOfType <InventoryUI>().Length;

        if (GameStatusCount > 1)
        {
            gameObject.SetActive(false);
            //Destroy(gameObject);
        }
        else
        {
            //DontDestroyOnLoad(gameObject);
            DontDestroyOnLoadManager.DontDestroyOnLoad(gameObject);
        }
    }
Пример #6
0
        public Timers()
        {
            _inst                = this;
            gameObject           = new GameObject("[FairyGUI.Timers]");
            gameObject.hideFlags = HideFlags.HideInHierarchy;
            gameObject.SetActive(true);
            //Object.DontDestroyOnLoad(gameObject);
            DontDestroyOnLoadManager.DontDestroyOnLoad(gameObject, 2, () => { _inst = null; }); //重启流程

            _engine = gameObject.AddComponent <TimersEngine>();

            _items    = new Dictionary <TimerCallback, Anymous_T>();
            _toAdd    = new Dictionary <TimerCallback, Anymous_T>();
            _toRemove = new List <Anymous_T>();
            _pool     = new List <Anymous_T>(100);
        }
Пример #7
0
    public void onStartClick()
    {
        string name = nameInput.text;
        string IP   = IPInput.text;

        Debug.Log(name + " " + IP);
        PlayerPrefs.SetString("name", name);
        PlayerPrefs.SetString("ip", IP);
        GameObject player = Instantiate(playerPrefab, new Vector3(), Quaternion.identity);

        player.name = name;
        player.GetComponent <Player>().playerName = name;
        DontDestroyOnLoadManager.DontDestroyOnLoad(player);

        SceneManager.LoadScene("lobby");
    }
Пример #8
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
         return;
     }
     gameObject.transform.parent = null;
     //DontDestroyOnLoad(gameObject);
     DontDestroyOnLoadManager.DontDestroyOnLoad(gameObject);
     GameEvents.SaveInitiated += Save;
     GameEvents.LoadInitiated += Load;
 }
Пример #9
0
    //private static MoveLetter letterInstance;

    /*
     * public string GetLetterStatus()
     * { return letterStatus; }
     *
     * public void SetLetterStatus(string value)
     * {
     *  letterStatus = value;
     * }
     */
    // Start is called before the first frame update
    void Start()
    {
        //DontDestroyOnLoad(this.gameObject);
        DontDestroyOnLoadManager.DontDestroyOnLoad(this.gameObject);

        /*if (letterInstance == null)
         * {
         *  letterInstance = this;
         * }
         * else
         * {
         *  DestroyObject(gameObject);
         * }
         */

        if (FindObjectsOfType(GetType()).Length > 9)
        {
            Destroy(gameObject);
        }
    }
Пример #10
0
        static void Init()
        {
            _inited = true;
            if (Application.isPlaying)
            {
                GameObject gameObject = new GameObject("[FairyGUI.TweenManager]");
                gameObject.hideFlags = HideFlags.HideInHierarchy;
                gameObject.SetActive(true);
                //Object.DontDestroyOnLoad(gameObject);
                DontDestroyOnLoadManager.DontDestroyOnLoad(gameObject, 2, () =>
                {
                    _inited       = false;
                    _activeTweens = new GTweener[30];
                    _tweenerPool.Clear();
                    _totalActiveTweens = 0;
                }
                                                           ); //重启流程

                gameObject.AddComponent <TweenEngine>();
            }
        }
Пример #11
0
 private void Awake()
 {
     DontDestroyOnLoadManager.DontDestroyOnLoad(transform.gameObject);
 }