Beispiel #1
0
        public void ShowHelp()
        {
            PlayerPrefsX.SetBool("first-time", false);

            SetPlayButtonInteractable(false);

            NavigationPointer     mainMenuPointer = new NavigationPointer(screenCategory, mainMenuName);
            NavigationPointer     helpPointer     = new NavigationPointer(screenCategory, helpName);
            NavigationPointer     help1Pointer    = new NavigationPointer(screenCategory, help1Name);
            NavigationPointerData data            = new NavigationPointerData(true);

            data.show.Add(helpPointer);
            data.show.Add(help1Pointer);
            data.hide.Add(mainMenuPointer);

            var temp = mainMenu.outAnimations.Copy();

            mainMenu.outAnimations = lastOutAnim.Copy();

            UINavigation.Show(data.show);
            UINavigation.Hide(data.hide);
            UINavigation.AddItemToHistory(data);

            mainMenu.outAnimations = temp;
        }
Beispiel #2
0
    void Awake()
    {
#if !UNITY_EDITOR
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
#endif
        shortTimer           = new Timer(0.2f);
        uiNavigationInstance = UINavigation.Instance;
        m_bMenuAnimator      = FindObjectOfType <Canvas>().GetComponent <Animator>();
        //Add me to the singleton tester
        //SingletonTester.Instance.AddSingleton(this);
        SceneManager.sceneLoaded += OnSceneLoad;

        m_SettingsPanel           = GameObject.Find("Options_Panel");
        m_CreditsPanel            = GameObject.Find("Credits_Panel"); //Currently null;
        m_CharacterSelectionPanel = GameObject.Find("Character_Selection");
        // m_SettingsPanel.SetActive((!m_SettingsPanel));

        //instance = FindObjectOfType<UIManager>();
        _eventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>();
        selected     = _eventSystem.currentSelectedGameObject;
        menuStatus   = new Stack <GameObject>();

        if (Instance.gameObject != this.gameObject)
        {
            Destroy(this.gameObject);
        }
    }
Beispiel #3
0
    public override void Update(float dt)
    {
        // 已打开界面的update,有需求才做
        ViewBase curView = UINavigation.GetLastItem();

        if (curView != null && curView.isOpen)
        {
            curView.Update();
        }

        // 自动回收cache的界面,todo这个是不是可以用个协程做
        var curTime = Time.time;

        if (curTime - m_lastCacheCheckTime > 1)
        {
            foreach (var item in m_viewMap)
            {
                var view = item.Value;
                //Debug.Log((view.closeTime - curTime > UIPANEL_CACHE_TIME).ToString());
                if (view.closeTime - curTime > UIPANEL_CACHE_TIME && !view.isOpen)
                {
                    m_viewMap[view.key] = null;
                    view.Dispose();
                }
            }
        }
    }
Beispiel #4
0
        public void HideHelp()
        {
            SetPlayButtonInteractable(false);

            NavigationPointer     mainMenuPointer = new NavigationPointer(screenCategory, mainMenuName);
            NavigationPointer     helpPointer     = new NavigationPointer(screenCategory, helpName);
            NavigationPointerData data            = new NavigationPointerData(true);

            data.show.Add(mainMenuPointer);
            data.hide.Add(helpPointer);

            var temp = mainMenu.inAnimations.Copy();

            mainMenu.inAnimations = firstInAnim.Copy();

            UINavigation.Show(data.show, true);
            UINavigation.Hide(data.hide);
            UINavigation.AddItemToHistory(data);

            help1.Hide(true);
            help2.Hide(true);
            help3.Hide(true);

            mainMenu.inAnimations = temp;
        }
Beispiel #5
0
 void UpdateTheNavigationHistory()
 {
     if (!UIManager.IsNavigationEnabled)
     {
         return;
     }
     UINavigation.UpdateTheNavigationHistory(navigationPointerData.Copy());
 }
Beispiel #6
0
 public override UIBattleCutNavigation SetAnchor(UINavigation <UIBattleCutNavigation> .Anchor iAnchor)
 {
     if (!this.settingModel.GuideDisplay)
     {
         return(this);
     }
     return(base.SetAnchor(iAnchor));
 }
Beispiel #7
0
    //初始化界面管理器状态
    private static void InitView(ViewBase view)
    {
        m_viewMap[view.key] = view;

        UINavigation.AddItem(view);
        view.Open();
        //--抛出界面打开完成事件
        //--设置场景摄像机状态
    }
    private void Start()
    {
        instance = this;
        joystick = FindObjectOfType <Joystick>();

        acceptButton.onClick.AddListener(() => {
            AcceptButton();
        });
    }
        void UpdateTheNavigationHistory()
        {
#if dUI_DoozyUI
            if (!UIManager.IsNavigationEnabled)
            {
                return;
            }
            UINavigation.UpdateTheNavigationHistory(navigationPointerData.Copy());
#endif
        }
Beispiel #10
0
 public UIModule()
 {
     UINavigation.Init();
     // 随缘7个
     m_viewMap  = new Dictionary <ViewID, ViewBase>(7);
     m_viewRoot = new Dictionary <ViewType, Transform>
     {
         { ViewType.MAIN, GameObject.Find("Canvas/Main").transform },
         { ViewType.POPUP, GameObject.Find("Canvas/Popup").transform },
         { ViewType.FIXED, GameObject.Find("Canvas/Fixed").transform },
     };
 }
Beispiel #11
0
 public void Start()
 {
     if (Instance)
     {
         return;
     }
     Instance = this;
     _uiNav   = GetComponent <UINavigation>();
     //if (_uiNav.GetElement("VelocityBar")) {
     //    VelocityBar = _uiNav.GetElement("VelocityBar").imgElement;
     //    velocityBarOrigRect = VelocityBar.rectTransform.rect;
     //}
 }//Start
Beispiel #12
0
    // Use this for initialization
    void Start()
    {
        m_UINavRef            = GetComponentInParent <UINavigation>();
        m_UINavRef.MenuButton = new Button[] { ResumeButton, SettingsButton, ExitButton, QuitButton };
        //Array.Reverse(m_UINavRef.MenuButton);

        ControllerSliderControl.enabled = false;

        ResumeButton.onClick.AddListener(ResumeButtonEvent);
        SettingsButton.onClick.AddListener(SettingsButtonEvent);
        ExitButton.onClick.AddListener(ExitButtonEvent);
        BackButton.onClick.AddListener(BackButtonEvent);
        QuitButton.onClick.AddListener(QuitButtonEvent);
        ConfirmQuitButton.onClick.AddListener(ConfirmQuitButtonEvent);
        DeclineQuitButton.onClick.AddListener(DeclineQuitButtonEvent);

        //BackButton.gameObject.SetActive(false);
    }
Beispiel #13
0
    // Use this for initialization

    void Awake()
    {
        m_Animator    = this.GetComponent <Animator>();
        m_AudioSource = this.GetComponent <AudioSource>();
        if (!m_AudioSource)
        {
            m_AudioSource                       = this.gameObject.AddComponent <AudioSource>();
            m_AudioSource.loop                  = false;
            m_AudioSource.playOnAwake           = false;
            m_AudioSource.outputAudioMixerGroup = AudioManager.RequestMixerGroup(SourceType.SFX);
        }

        if (transform.childCount > 3 && GameManagerc.Instance.m_bDoLogoTransition)
        {
            TeamLogo    = this.transform.GetChild(4).GetComponent <Image>();
            BlackOut    = this.transform.GetChild(5).GetComponent <Image>();
            BlackOut2nd = this.transform.GetChild(3).GetComponent <Image>(); //because render order

            fadingQueue.Enqueue(BlackOut);
            fadingQueue.Enqueue(TeamLogo);
            fadingQueue.Enqueue(BlackOut2nd);


            StartCoroutine(WakeUp());
        }
        else //When the game doesn't want to do the logo transition
        {
            if (transform.childCount > 3)
            {
                TeamLogo            = this.transform.GetChild(4).GetComponent <Image>(); //TODO Need to Re-add to the queue so it Fades in and then fades out.
                BlackOut            = this.transform.GetChild(5).GetComponent <Image>();
                BlackOut2nd         = this.transform.GetChild(3).GetComponent <Image>();
                TeamLogo.enabled    = false;
                BlackOut.enabled    = false;
                BlackOut2nd.enabled = false;
            }
            OpenDoor();
        }

        // OpenDoor();
        _UINavi                   = UINavigation.Instance;
        _eventSystem              = FindObjectOfType <EventSystem>();
        SceneManager.sceneLoaded += OnSceneLoad;
    }
Beispiel #14
0
 public void Start()
 {
     if (Instance != null)
     {
         DestroyImmediate(this.gameObject);
         return;
     }
     FindAllUiElements();
     Instance = this;
     if (_canvas == null)
     {
         _canvas = GetComponent <Canvas>();
     }
     if (_canvas.worldCamera == null)
     {
         _canvas.worldCamera = Camera.main;
     }
     DontDestroyOnLoad(this.gameObject);
 }//Start
Beispiel #15
0
    void AssignGhosts()
    {
        // find and assign ghosts
        clyde  = GameObject.Find("clyde");
        pinky  = GameObject.Find("pinky");
        inky   = GameObject.Find("inky");
        blinky = GameObject.Find("blinky");

        if (clyde == null || pinky == null || inky == null || blinky == null)
        {
            Debug.Log("One of ghosts are NULL");
        }

        gui = GameObject.FindObjectOfType <UINavigation>();

        if (gui == null)
        {
            Debug.Log("GUI Handle Null!");
        }
    }
Beispiel #16
0
    public static void CloseView(ViewID key)
    {
        ViewBase view = GetView(key);

        if (view != null)
        {
            if (view.isOpen)
            {
                view.Close();
                UINavigation.RemoveLastItem(view);
            }
            else
            {
                GameLog.LogWarning("[UIModule]界面关闭失败,已经关闭!" + key.ToString());
            }
        }
        else
        {
            GameLog.LogError("[UIModule]界面关闭失败,没有找到指定界面!" + key.ToString());
        }
    }
Beispiel #17
0
 public void ShowScreenAndHideOthers(string group, string screen, bool AddNavStory)
 {
     UINavigation.ShowUiElementAndHideAllTheOthers(screen, group, AddNavStory);
 }
Beispiel #18
0
 public void ShowScreen(string group, string screen, bool AddNavStory)
 {
     UINavigation.ShowUiElement(screen, group, AddNavStory);
 }
Beispiel #19
0
 public void SetListeners(UINavigation inputNav, Action <string> autocorrectFunction)
 {
     selectable.onClick.AddListener(inputNav.selectable.Select);
     selectable.onClick.AddListener(() => autocorrectFunction(textField.text));
 }
Beispiel #20
0
 private void Awake()
 {
     textField  = GetComponentInChildren <TextMeshProUGUI>();
     navigation = GetComponent <UINavigation>();
     selectable = GetComponent <Button>();
 }
Beispiel #21
0
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)

    {
        //oh fukc
        //check if the instance is this game object

        //If the map to load isnt null, load it
        if (scene.buildIndex == 1)
        {
            m_bWinnerFound = false;
            m_bAllowPause  = true;
            UINavigation LoadInstance = UINavigation.Instance;
            GetComponent <MusicFader>().FadeIn();



            if (!m_bFirstTimeLoading) //if this isn't the first time loading into the scene
            {
                if (FindObjectOfType <ScreenTransition>())
                {
                    screenTransition = FindObjectOfType <ScreenTransition>();
                    for (int i = 0; i < screenTransition.transform.childCount; i++)
                    {
                        screenTransition.transform.GetChild(i).GetComponent <Image>().enabled = false;
                    }
                }
                if (m_bDoGlitch)
                {
                    //Reversee glitch
                    StartCoroutine(InterpolateGlitch(true));
                    m_bPlayedGlitchAudio = false;
                    m_AudioSource.clip   = m_LMSDingSound;
                }
            }
            else
            {
                m_bFirstTimeLoading = false;
            }

            if (MapToLoad) //load the map first
            {
                GameObject go = Instantiate(MapToLoad);
                go.transform.position = Vector3.zero;
                go.transform.DetachChildren();
                mInstance.mbMapLoaded = true;
                ControllerManager.Instance.FindSpawns();
                CharacterSelectionManager.Instance.LoadPlayers();
            }
            //If I found the finished game panel
            if (GameObject.Find("FinishedGamePanel"))
            {
                //Set the UI panel reference to that object
                FinishUIPanel = GameObject.Find("FinishedGamePanel");
                //set the object buttons delegates
                FinishUIPanel.transform.Find("Rematch").GetComponent <Button>().onClick.AddListener(delegate { Rematch(); });
                FinishUIPanel.transform.Find("Main Menu").GetComponent <Button>().onClick.AddListener(delegate { GoToStart(); });

                //turn the children off (so this object can still be found if needed be);
                for (int i = 0; i < FinishUIPanel.transform.childCount; ++i)
                {
                    FinishUIPanel.transform.GetChild(i).gameObject.SetActive(false);
                }
            }
            MenuPanel = GameObject.Find("PausePanel");
            UIManager.Instance.SetDefaultPanel(MenuPanel);
            //MenuPanel.SetActive(true);
            //Find the points panel and populate the array.

            PointsPanel          = GameObject.Find("PointsPanel");
            InGameScreenAnimator = PointsPanel.GetComponentInParent <Animator>();
            PointXPositions      = new GameObject[GameObject.Find("PointXPositions").transform.childCount];
            for (int i = 0; i < PointXPositions.Length; i++)
            {
                PointXPositions[i] = GameObject.Find("PointXPositions").transform.GetChild(i).gameObject;
            }

            //Populate the Y positions
            PointYPositions = new GameObject[GameObject.Find("PointYPositions").transform.childCount];
            for (int i = 0; i < PointYPositions.Length; i++)
            {
                PointYPositions[i] = GameObject.Find("PointYPositions").transform.GetChild(i).gameObject;
            }

            //Populate the array

            #region Point panel, and point containers

            PointContainers = new GameObject[PointsPanel.transform.childCount];
            GameObject[] ActivePanels     = new GameObject[4 - CharacterSelectionManager.Instance.JoinedPlayers];
            int          ActivePanelIndex = 0;

            //Move the point containers depending on how many points are required.

            for (int i = 0; i < PointsPanel.transform.childCount; i++)
            {
                PointContainers[i] = PointsPanel.transform.GetChild(i).gameObject;
                for (int j = 0; j < PointContainers[i].transform.childCount; j++)
                {
                    if (PointContainers[i].transform.GetChild(j).GetComponent <Animator>())
                    {
                        switch (m_gameMode)
                        {
                        case Gamemode_type.LAST_MAN_STANDING_DEATHMATCH:
                            PointContainers[i].transform.GetChild(j).GetComponent <Animator>().SetBool("CircuitBreaker", true);
                            break;

                        case Gamemode_type.HEAD_HUNTERS:
                            PointContainers[i].transform.GetChild(j).GetComponent <Animator>().SetBool("HeadHunter", true);
                            break;

                        default:
                            break;
                        }
                    }
                    foreach (Image imagerenderer in PointContainers[i].transform.GetChild(j).GetComponentsInChildren <Image>())
                    {
                        imagerenderer.enabled = false;
                    }
                }
                Vector3 temp = PointContainers[i].transform.position;
                //Get the last object in container (portrait)
                PointContainers[i].transform.position = new Vector3(PointXPositions[m_iPointsIndex].transform.position.x, temp.y, temp.z);

                //For every object after the points neeeded, turn them off since their not required.
                for (int j = m_iPointsNeeded; j < PointContainers[i].transform.childCount - 1; j++)
                {
                    PointContainers[i].transform.GetChild(j).gameObject.SetActive(false);
                }
                //Turn off the containers so they don't show up.
            }

            //Load player portraits.
            foreach (var item in CharacterSelectionManager.Instance.playerSelectedCharacter)
            {
                int playerNumber = (int)item.Key - 1;

                if (item.Value.GetComponent <BaseAbility>().m_CharacterPortrait) //If the character has a portrait
                {
                    //Get the last object in point containers (the portrait container), get the first child (the "fill"- what is consitency) and change its sprite to the character's (item.value) sprite found in the base ability.
                    PointContainers[playerNumber].transform.GetChild(PointContainers[playerNumber].transform.childCount - 1).GetChild(0).GetComponent <Image>().sprite = item.Value.GetComponent <BaseAbility>().m_CharacterPortrait;
                    Image portraitOutline = PointContainers[playerNumber].transform.GetChild(PointContainers[playerNumber].transform.childCount - 1).GetChild(1).GetComponent <Image>();
                    portraitOutline.material.SetColor("_Color", Color.white);
                    Move tempMove = item.Value.GetComponent <Move>();

                    Database ColorDatabase = Resources.Load("Database") as Database;

                    Dictionary <string, Color> colorDictionary = new Dictionary <string, Color>();
                    for (int i = 0; i < ColorDatabase.colors.Length; i++)
                    {
                        if (!colorDictionary.ContainsKey(ColorDatabase.colors[i].PlayerType))
                        {
                            colorDictionary.Add(ColorDatabase.colors[i].PlayerType, ColorDatabase.colors[i].playerColor);
                        }
                    }
                    portraitOutline.color = colorDictionary[tempMove.ColorDatabaseKey];
                }
            }

            //can also be used for the amount of players in the scene.
            XboxController[] JoinedXboxControllers = new XboxController[CharacterSelectionManager.Instance.playerSelectedCharacter.Count];
            int nextIndex = 0;

            for (int i = 0; i < 4; i++)
            {
                if (CharacterSelectionManager.Instance.playerSelectedCharacter.ContainsKey(XboxController.First + i))
                {
                    JoinedXboxControllers[nextIndex] = XboxController.First + i;
                    nextIndex++;
                }
            }

            //Turn every player's UI on.
            foreach (var item in JoinedXboxControllers)
            {
                PointContainers[(int)item - 1].SetActive(true);
                ActivePanels[ActivePanelIndex] = PointContainers[(int)item - 1];
                ActivePanelIndex++;
            }

            //for (int i = PointContainers.Length - 1; i > ActivePanelIndex - 1; i--)
            //{
            //    PointContainers[i].SetActive(false);
            //}
            for (int i = 0; i < PointContainers.Length; i++)
            {
                PointContainers[i].SetActive(false);
            }
            foreach (var item in JoinedXboxControllers)
            {
                PointContainers[(int)item - 1].SetActive(true);
                for (int j = 0; j < PointContainers[(int)item - 1].transform.childCount; j++)
                {
                    if (PointContainers[(int)item - 1].transform.GetChild(j).GetComponent <Animator>())
                    {
                        switch (m_gameMode)
                        {
                        case Gamemode_type.LAST_MAN_STANDING_DEATHMATCH:
                            PointContainers[(int)item - 1].transform.GetChild(j).GetComponent <Animator>().SetBool("CircuitBreaker", true);
                            break;

                        case Gamemode_type.HEAD_HUNTERS:
                            PointContainers[(int)item - 1].transform.GetChild(j).GetComponent <Animator>().SetBool("HeadHunter", true);
                            break;

                        default:
                            break;
                        }
                    }
                    foreach (Image imagerenderer in PointContainers[(int)item - 1].transform.GetChild(j).GetComponentsInChildren <Image>())
                    {
                        imagerenderer.enabled = false;
                    }
                }
            }
            for (int i = 0; i < 4 - CharacterSelectionManager.Instance.JoinedPlayers; i++)
            {
                Vector3 temp = ActivePanels[i].transform.position;
                ActivePanels[i].transform.position = new Vector3(temp.x, PointYPositions[4 - CharacterSelectionManager.Instance.JoinedPlayers - 2].transform.GetChild(i).position.y, temp.z);
            }

            foreach (var Player in InGamePlayers) //For every player in the game.
            {
                int iPlayerIndex = XboxControllerPlayerNumbers[Player.GetComponent <ControllerSetter>().mXboxController];
                for (int j = 0; j < PlayerWins[Player]; j++) //For every point the player has.
                {
                    if (PlayerWins[Player] > 0)
                    {
                        if (PointContainers[iPlayerIndex].transform.GetChild(j).GetComponent <Animator>())
                        {
                            Image temp = PointContainers[iPlayerIndex].transform.GetChild(j).GetComponent <Image>();
                            PointContainers[iPlayerIndex].transform.GetChild(j).GetComponent <Animator>().SetTrigger("PointGain");
                            PointContainers[iPlayerIndex].transform.GetChild(j).GetComponent <Image>().color = Color.blue;
                        }
                    }
                }
            }
            #endregion


            //PointsPanel.SetActive(false);
            ReadyKillContainer = GameObject.Find("StartScreen");
            GameObject KillAudio = ReadyKillContainer.transform.GetChild(0).gameObject;
            GameObject GetReady  = ReadyKillContainer.transform.GetChild(1).gameObject;

            //if (m_bShowReadyFight)

            if (m_bDoReadyKill)
            {
                StartCoroutine(ReadyKill(ReadyKillContainer));
            }
            //find weapons and add shit to them


            _rbPausers.Clear();
            _rbPausers = new List <RigidbodyPauser>();
            foreach (Rigidbody2D item in FindObjectsOfType <Rigidbody2D>())
            {
                if (item.GetComponentInParent <Weapon>())
                {
                    if (!item.GetComponent <RigidbodyPauser>())
                    {
                        RigidbodyPauser rbp = item.gameObject.AddComponent <RigidbodyPauser>();
                        if (!_rbPausers.Contains(rbp))
                        {
                            _rbPausers.Add(rbp);
                        }
                    }
                    else
                    {
                        RigidbodyPauser rbp = item.gameObject.GetComponent <RigidbodyPauser>();
                        if (!_rbPausers.Contains(rbp))
                        {
                            _rbPausers.Add(rbp);
                        }
                    }
                }
            }

            //m_bRoundReady = true;
            m_bDoLogoTransition = false;
            //PointsPanel.SetActive(false);
            //mInstance.mbLoadedIntoGame = true;
        }
    }