コード例 #1
0
        private void CreateUserMenu(ChatUser user , object infotarget, int length)
	{
        bool canOpenContextMenu = (bool)typeof(ChatUI).GetField("canOpenContextMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(infotarget);
        Gui.ContextMenu<ChatUser> userContextMenu = null;      

		if (!canOpenContextMenu)
		{
			return;
		}
		Vector3 mousePosition = Input.mousePosition;
		Rect rect = new Rect(Mathf.Min((float)(Screen.width - 105), mousePosition.x+100), Mathf.Min((float)(Screen.height - 90 - 5), (float)Screen.height - mousePosition.y), Mathf.Max(100f,length+10), 30f);
		userContextMenu = new Gui.ContextMenu<ChatUser>(user, rect);

        userContextMenu.add(user.name, new Gui.ContextMenu<ChatUser>.URCMCallback(ProfileUser)); 
       
		if (user.acceptTrades)
		{
            userContextMenu.add("Trade", new Gui.ContextMenu<ChatUser>.URCMCallback(TradeUser));
		}

        userContextMenu.add("Whisper", new Gui.ContextMenu<ChatUser>.URCMCallback(whisperclick));

        if (user.acceptChallenges)
        {
            userContextMenu.add("Challenge", new Gui.ContextMenu<ChatUser>.URCMCallback(ChallengeUser));
        }
        userContextMenuField.SetValue(target, userContextMenu);
        App.AudioScript.PlaySFX("Sounds/hyperduck/UI/ui_button_click");
        //Console.WriteLine("bums");
	}
コード例 #2
0
        private void copyDeckMenu(ChatUser user, string deck)
        {
            Vector3 mousePosition = Input.mousePosition;
            // need 30 pixels of extra space per item added

            Rect rect = new Rect(Mathf.Min((float)(Screen.width - 105), mousePosition.x), Mathf.Min((float)(Screen.height - 90 - 5), (float)Screen.height - mousePosition.y), 100f, 30f);

            this.globallink = deck;
            Gui.ContextMenu<ChatUser> userContextMenu = new Gui.ContextMenu<ChatUser>(user, rect);
            userContextMenu.add("Copy Deck", new Gui.ContextMenu<ChatUser>.URCMCallback(CopyLink));
            
            if (userContextMenu != null)
            {
                userContextMenuField.SetValue(target, userContextMenu);
                App.AudioScript.PlaySFX("Sounds/hyperduck/UI/ui_button_click");
            }

        }