示例#1
0
    public void PopUpActive(ePopupType type, bool Active)
    {
        AllPopUpActive(false);
        switch (type)
        {
        case ePopupType.Clear:
            ClearPopUp.SetActive(Active);
            break;

        case ePopupType.NoClear:
            NoClearPopUp.SetActive(Active);
            break;

        case ePopupType.Advertise:
            AdvertiseMentPopUp.SetActive(Active);
            break;

        case ePopupType.Quit:
            QuitPopUp.SetActive(Active);
            break;

        case ePopupType.CommingSoon:
            CommingSoonPopUp.SetActive(Active);
            break;

        case ePopupType.NoAds:
            NoAdsPopUp.SetActive(Active);
            break;
        }
    }
    //public void hidePopupScreen(ePopupType _type)
    //{
    //    GameObject objScreenPopup = GetPopupByType(_type);
    //    CurrentPopup = ePopupType.NONE;
    //    if (objScreenPopup)
    //    {
    //        objScreenPopup.SetActive(false);
    //    }
    //}

    public void DestroyPopupByType(ePopupType _type)
    {
        Destroy(GetPopupByType(_type));
        int index = GetIndexOfPopup(_type);

        m_arrayMyPopup = RemoveAt(m_arrayMyPopup, index);
    }
示例#3
0
    public void ShowPopup(ePopupType type, string title, string content, System.Action <bool> callback)
    {
        GameObject popupObj = (GameObject)Instantiate(m_PopupPrefab, m_Canvas.transform);

        popupObj.transform.SetSiblingIndex(0);                  // make sure it doesn't show up over the Fade Scrim
        m_CurrentPopup     = popupObj.GetComponent <UIPopup>(); // TODO should probably use a stack for easily managing multiple popups
        m_CurrentPopupType = type;
        m_CloseCallback    = callback;

        List <UIPromptInfo> prompts = new List <UIPromptInfo>()
        {
            m_Prompts[0]
        };

        switch (m_CurrentPopupType)
        {
        case ePopupType.Confirm:
            m_Prompts[0].m_LabelText = "Okay";
            break;

        case ePopupType.YesNo:
            m_Prompts[0].m_LabelText = "Yes";
            m_Prompts[1].m_LabelText = "No";

            prompts.Add(m_Prompts[1]);
            break;
        }

        m_CurrentPopup.SetData(title, content, prompts);
        m_CurrentPopup.Show();

        InputManager.Instance.AddInputEventDelegate(OnInputUpdate, UpdateLoopType.Update);
    }
 private int GetIndexOfPopup(ePopupType _type)
 {
     for (int i = 0; i < m_arrayMyPopup.Length; i++)
     {
         if (m_arrayMyPopup[i].m_popupType == _type)
         {
             return(i);
         }
     }
     return(0);
 }
    private GameObject GetPopupByType(ePopupType _type)
    {
        if (m_dicPopup.ContainsKey(_type))
        {
            return(m_dicPopup[_type]);
        }
#if UNITY_EDITOR
        Debug.Log("ko get duoc man hinh nay!");
#endif
        return(null);
    }
 void Start()
 {
     CurrentPopup = ePopupType.NONE;
     //if (!PlayerPrefs.HasKey("letterCards"))
     //{
     //    ShowPopupScreen(ePopupType.DOWNLOAD);
     //}
     //else
     //{
     //    DestroyPopupByType(ePopupType.DOWNLOAD);
     //}
 }
    public void ShowPopupScreen(ePopupType _type)
    {
        GameObject objScreenPopup = GetPopupByType(_type);

        HideCurrentPopup();
        HideScreenByType(CurrentScreen);
        if (_type == ePopupType.OPTION || _type == ePopupType.SETTING)
        {
            m_generalScreen.gameObject.SetActive(true);
            m_generalScreen.SetUp(_type);
        }
        if (objScreenPopup)
        {
            objScreenPopup.SetActive(true);
        }
        CurrentPopup = _type;
    }
    public void HideCurrentPopup()
    {
        if (CurrentPopup == ePopupType.NONE)
        {
            return;
        }
        GameObject objScreenPopup = GetPopupByType(CurrentPopup);

        if (objScreenPopup)
        {
            m_generalScreen.gameObject.SetActive(false);
            objScreenPopup.SetActive(false);
            CurrentPopup = ePopupType.NONE;
        }
        //ShowScreenByType(CurrentScreen);
        ShowCurrentScreen();
    }
示例#9
0
    public void SetUp(ePopupType _popupType)
    {
        TopMoveDown();
        m_backSceneHandle.onScreenHandler = false;
        switch (_popupType)
        {
        case ePopupType.OPTION:
            SetupTitleTextWithType(eTextTitleType.PAUSE);
            break;

        case ePopupType.SETTING:
            SetupTitleTextWithType(eTextTitleType.SETTING);
            break;

        case ePopupType.ABOUT:
            SetupTitleTextWithType(eTextTitleType.ABOUT);
            break;
        }
        SetButtonBackIcon(false);
    }
示例#10
0
    public void SetPopupType(ePopupType PopupType, string PopupTitle, string PopupMessage)
    {
        switch (PopupType)
        {
        case ePopupType.Active:
            btnActive.Focus();
            break;

        case ePopupType.Deactive:
            btnDeactive.Focus();
            break;

        case ePopupType.Delete:
            btnDelete.Focus();
            break;
        }

        btnActive.Visible   = PopupType == ePopupType.Active;
        btnDeactive.Visible = PopupType == ePopupType.Deactive;
        btnDelete.Visible   = PopupType == ePopupType.Delete;

        lblPopupTitle.Text   = PopupTitle;
        lblPopupMessage.Text = PopupMessage;
    }
    protected override void OnInputUpdate(InputActionEventData data)
    {
        if (ScreenInputLocked() || (m_ControlledBySinglePlayer && data.playerId != m_ControllingPlayerID))
        {
            return;
        }

        bool handled = false;

        switch (data.actionId)
        {
        //case RewiredConsts.Action.Navigate_Vertical:
        //    float value = data.GetAxis();
        //    if (value != 0f && m_CurrentTime <= 0f)
        //    {
        //        if (value < 0f)
        //        {
        //            m_ActiveIndex = (m_ActiveIndex + 1) % m_ListItems.Count;
        //        }
        //        else if (value > 0f)
        //        {
        //            if (m_ActiveIndex - 1 < 0)
        //            {
        //                m_ActiveIndex = m_ListItems.Count;
        //            }

        //            m_ActiveIndex -= 1;
        //        }

        //        m_CurrentTime = m_ScrollDelay;

        //        // audio
        //        //VSEventManager.Instance.TriggerEvent(new AudioEvents.RequestUIAudioEvent(true, AudioManager.eUIClip.Navigate));

        //        handled = true;
        //    }
        //    m_CurrentTime -= Time.deltaTime;
        //    break;

        case RewiredConsts.Action.Confirm:
            if (data.GetButtonDown())
            {
                handled = true;
            }
            break;

        case RewiredConsts.Action.Cancel:
            if (data.GetButtonDown())
            {
                if (m_CanAbandon)
                {
                    string     popupTitle   = "Character";
                    string     popupContent = "Do you want to abandon this Character? All changes will be lost.";
                    ePopupType popupType    = ePopupType.YesNo;
                    PopupManager.Instance.ShowPopup(popupType, popupTitle, popupContent, OnCreationAbandoned);
                }

                handled = true;
            }
            break;

        case RewiredConsts.Action.Y_Action:
            if (data.GetButtonDown())
            {
                string     popupTitle   = "Character";
                string     popupContent = "Are you finished creating this character?";
                ePopupType popupType    = ePopupType.YesNo;
                PopupManager.Instance.ShowPopup(popupType, popupTitle, popupContent, OnCreationFinished);

                handled = true;
            }
            break;
        }

        // pass to base
        if (!handled)
        {
            base.OnInputUpdate(data);
        }
    }
示例#12
0
		/// <summary>
		/// Creates new instance of PopupItem and assigns the name and text to it.
		/// </summary>
		/// <param name="sName">Item name.</param>
		/// <param name="ItemText">Item text.</param>
		public PopupItem(string sName, string ItemText):base(sName, ItemText)
		{
			m_PopupMenu=null;
			m_PopupBar=null;
			m_FilterInstalled=false;
			m_PopupType=ePopupType.Menu;
			m_SideBar=new SideBarImage();
			m_WasParentFocused=false;
			m_OldSubItemsImageSize=Size.Empty;
		}
示例#13
0
		public override void Deserialize(ItemSerializationContext context)
		{
			base.Deserialize(context);
            System.Xml.XmlElement ItemXmlSource = context.ItemXmlElement;
			m_PopupType=(ePopupType)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("PopupType"));
			m_PopupWidth=System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("PopupWidth"));
			m_PersonalizedMenus=(ePersonalizedMenus)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("PersonalizedMenus"));

			if(ItemXmlSource.HasAttribute("panim"))
				m_PopupAnimation=(ePopupAnimation)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("panim"));
			else
				m_PopupAnimation=ePopupAnimation.SystemDefault;

			m_PopupFont=null;
			// Load font information if it exists
			if(ItemXmlSource.HasAttribute("fontname"))
			{
				string FontName=ItemXmlSource.GetAttribute("fontname");
				float FontSize=System.Xml.XmlConvert.ToSingle(ItemXmlSource.GetAttribute("fontemsize"));
				System.Drawing.FontStyle FontStyle=(System.Drawing.FontStyle)System.Xml.XmlConvert.ToInt32(ItemXmlSource.GetAttribute("fontstyle"));
				try
				{
					m_PopupFont=new Font(FontName,FontSize,FontStyle);
				}
				catch(Exception)
				{
					m_PopupFont=null;
				}
			}
		}
示例#14
0
    protected override void OnInputUpdate(InputActionEventData data)
    {
        if (ScreenInputLocked())
        {
            return;                      // can be controller by any player
        }
        bool handled = false;

        // this is ugly
        if (m_CharacterSelectors[data.playerId].m_IsActive)
        {
            handled = m_CharacterSelectors[data.playerId].OnInputUpdate(data);
            if (handled)
            {
                return;
            }
        }

        switch (data.actionId)
        {
        case RewiredConsts.Action.Y_Action:
            if (data.GetButtonDown())
            {
                string     popupTitle   = string.Format("P{0}", data.playerId + 1);
                string     popupContent = "Would you like to create a new character?";
                ePopupType popupType    = ePopupType.YesNo;
                PopupManager.Instance.ShowPopup(popupType, popupTitle, popupContent, OnCharacterCreationPopupClosed);

                // save which player opened it
                m_CreatorPlayerID = data.playerId;

                handled = true;
            }
            break;

        case RewiredConsts.Action.Confirm:
            if (data.GetButtonDown())
            {
                if (data.playerId == 0 && LobbyManager.Instance.AllPlayersReady && !AnyCharacterSelectorOpen())     // TODO only server/host should be able to advance
                {
                    string     popupTitle   = "Continue";
                    string     popupContent = "Are you ready?";
                    ePopupType popupType    = ePopupType.YesNo;
                    PopupManager.Instance.ShowPopup(popupType, popupTitle, popupContent, OnContinuePopupClosed);
                }
                else
                {
                    int             playerId   = data.playerId;
                    PlayerLobbyData playerData = LobbyManager.Instance.GetLobbyDataForPlayer(playerId);
                    if (playerData != null)
                    {
                        if (!playerData.m_Confirmed)
                        {
                            // player data exists, ready up
                            LobbyManager.Instance.SetConfirmed(playerId, true);
                            Debug.LogFormat("P{0} Ready", playerId + 1);
                        }
                    }
                    else
                    {
                        // no player exists, open the character selector
                        if (!m_CharacterSelectors[data.playerId].m_IsActive)
                        {
                            m_CharacterSelectors[data.playerId].SetIsActive(true);
                        }
                    }
                }

                handled = true;
            }
            break;

        case RewiredConsts.Action.Cancel:
            if (data.GetButtonDown())
            {
                int             playerId   = data.playerId;
                PlayerLobbyData playerData = LobbyManager.Instance.GetLobbyDataForPlayer(playerId);
                if (playerData != null)
                {
                    if (playerData.m_Confirmed)
                    {
                        // player is ready, un-ready them
                        LobbyManager.Instance.SetConfirmed(playerId, false);
                        Debug.LogFormat("P{0} Un-ready", playerId + 1);
                    }
                    else
                    {
                        if (playerId == 0)     // need to change this to a host player id check
                        {
                            string     popupTitle   = "Exit";
                            string     popupContent = "Are you sure you want to leave the lobby?";
                            ePopupType popupType    = ePopupType.YesNo;
                            PopupManager.Instance.ShowPopup(popupType, popupTitle, popupContent, OnExitPopupClosed);
                        }
                        else
                        {
                            // player wants to drop out
                            LobbyManager.Instance.RequestRemovePlayer(playerId);

                            // need to add back in the character data from any player who backed out
                            ShowCharacterInList(m_CharacterList[playerId]);
                        }
                    }
                }

                handled = true;
            }
            break;
        }

        // pass to base
        if (!handled)
        {
            base.OnInputUpdate(data);
        }
    }