コード例 #1
0
ファイル: MainMenu.cs プロジェクト: QueenPrinsessa/MageBall
        private void Start()
        {
            Cursor.lockState = CursorLockMode.None;

            if (networkManager == null && NetworkManager.singleton == null)
            {
                GameObject networkManagerGameObject = Instantiate(networkManagerPrefab);
                networkManager = networkManagerGameObject.GetComponent <NetworkManagerMageBall>();
                if (networkManager == null)
                {
                    Debug.LogError("There is no NetworkManagerMageBall component on the networkmanager prefab. Did you accidentally use the default NetworkManager instead?");
                }
            }
            else if (networkManager == null)
            {
                networkManager = (NetworkManagerMageBall)NetworkManager.singleton;
                if (networkManager.isNetworkActive)
                {
                    titleScreenPanel.SetActive(false);
                }
            }

            optionsMenu = GetComponentInChildren <OptionsMenu>();
            if (optionsMenu == null)
            {
                Debug.LogError("There is no Options Menu in the Main Menu!");
            }

            menuButtonController = titleScreenPanel.GetComponent <MenuButtonController>();
            NetworkManagerMageBall.ClientStopped += OnStopClient;
        }
コード例 #2
0
ファイル: MenuButton.cs プロジェクト: QueenPrinsessa/MageBall
 private void Start()
 {
     button               = gameObject.GetComponent <Button>();
     animator             = gameObject.GetComponent <Animator>();
     menuButtonController = gameObject.GetComponentInParent <MenuButtonController>();
     button.interactable  = false;
     if (menuButtonController == null)
     {
         Debug.LogError("There is no MenuButtonController in the parent object. MenuButton won't work!");
     }
 }