static public ButtonDelegate[] GetButtons()
        {
            //Get PQS
            int numFiles = 0;

            List <string> FileNames = new List <string>();

            DirectoryInfo directory = new DirectoryInfo("GameInfo/KittopiaSpace/Textures/" + PlanetName + "/PQS/");
            var           files     = directory.GetFiles("*.png");

            foreach (FileInfo f in files)
            {
                FileNames.Add(f.Name);
                numFiles++;
            }

            ButtonDelegate[] delgates = new ButtonDelegate[numFiles + 2];

            //Populate lists
            int i;

            for (i = 0; i < numFiles; i++)
            {
                delgates[i] = Button_Select;
            }
            //i++;
            delgates[i] = Button_Select;

            return(delgates);
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Lcdisplay"/> class.
        /// </summary>
        private Lcdisplay()
        {
            m_defaultFont = FontFactory.GetFont("Microsoft Sans Serif", 13.5f, FontStyle.Regular, GraphicsUnit.Point);

            m_bmpLCD = new Bitmap(G15Width, G15Height, PixelFormat.Format24bppRgb);
            m_bmpLCD.SetResolution(G15DpiX, G15DpiY);
            m_lcdCanvas = Graphics.FromImage(m_bmpLCD);
            m_lcdCanvas.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;

            m_bmpLCDX = new Bitmap(G15Width, G15Height, PixelFormat.Format24bppRgb);
            m_bmpLCDX.SetResolution(G15DpiX, G15DpiY);
            m_lcdOverlay = Graphics.FromImage(m_bmpLCDX);
            m_lcdOverlay.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;

            m_buttonStateHld         = DateTime.Now;
            m_cycleTime              = DateTime.Now.AddSeconds(10);
            m_cycleQueueInfoTime     = DateTime.Now.AddSeconds(5);
            m_showingCycledQueueInfo = false;

            Cycle                           = false;
            ShowSystemTime                  = false;
            CycleSkillQueueTime             = false;
            FirstSkillCompletionRemaingTime = TimeSpan.FromTicks(DateTime.Now.Ticks);

            m_buttonDelegate = new ButtonDelegate(OnButtonsPressed);
            LCDInterface.AssignButtonDelegate(m_buttonDelegate);
            LCDInterface.Open("EVEMon", false);
        }
 public static AxisDelegate CreateAxisDelegate(ButtonDelegate positive, ButtonDelegate negative)
 {
     if (positive != null && negative != null)
     {
         return(() =>
         {
             if (positive())
             {
                 return negative() ? 0f : 1f;
             }
             else if (negative())
             {
                 return -1f;
             }
             else
             {
                 return 0f;
             }
         });
     }
     else if (positive != null)
     {
         return(() => positive() ? 1f : 0f);
     }
     else if (negative != null)
     {
         return(() => positive() ? -1f : 0f);
     }
     else
     {
         return(null);
     }
 }
예제 #4
0
        public ToolBarButton AddButton(string title, ButtonDelegate buttonDelegate)
        {
            ToolBarButton button = new ToolBarButton(title, buttonDelegate);

            AddSubview(button);
            return(button);
        }
예제 #5
0
    public static void showLabel(Rect rect, string text, GUIStyle style, ButtonDelegate cb)
    {
        Rect posSz = normalizeRectToScreenRect(rect);

        GUI.Label(posSz, text, style);
        cb(null);
    }
        public BlockingScreen(View messageView, ButtonDelegate buttonDelegate = null)
        {
            AllowsDrawPrevious   = true;
            AllowsUpdatePrevious = true;

            m_delegate = buttonDelegate;

            View contentView = new RectView(0, 0, 366, 182, Color.Black, Color.White);

            contentView.x      = 0.5f * width;
            contentView.y      = 0.5f * height;
            contentView.alignX = contentView.alignY = View.ALIGN_CENTER;

            messageView.x      = 0.5f * contentView.width;
            messageView.y      = 0.5f * contentView.height;
            messageView.alignX = messageView.alignY = View.ALIGN_CENTER;
            contentView.AddView(messageView);

            Button cancelButton = new TempButton("Cancel");

            cancelButton.x              = 0.5f * contentView.width;
            cancelButton.y              = contentView.height - 12;
            cancelButton.alignX         = View.ALIGN_CENTER;
            cancelButton.alignY         = View.ALIGN_MAX;
            cancelButton.buttonDelegate = CancelButtonDelegate;
            SetCancelButton(cancelButton);

            contentView.AddView(cancelButton);

            AddView(contentView);
        }
    // Use this for initialization
    void Start()
    {
        // Manager
        levelManager = GameObject.Find("LevelManager").GetComponent <LevelManager>();

        // Colors
        selectedColor = Color.white;
        defaultColor  = Color.gray;

        // UI
        parent = GameObject.Find("StageTransition");
        stages = new Dictionary <int, GameObject>();

        // Callbacks
        methodOnClick = OnStageClick;

        // Attributes
        currStage         = 0;
        enemyTypesAtStage = new Dictionary <int, int>();
        // <stage + 1,prefab index>
        // Add young master at stage 1
        enemyTypesAtStage.Add(0, 0);
        // Add ninja at stage 2
        enemyTypesAtStage.Add(1, 2);
        bossTypesAtStage = new Dictionary <int, int>();
        // temp... maybe find a better way to refactor this to be more abstract TODO
        descriptions = new Dictionary <int, string>();
        descriptions.Add(0, "This is stage one. Full of arrogant young masters that need some face slapping. Time to teach them some lessons!!");
        descriptions.Add(1, "The arrogant young masters hired some ninja. These ninja are expert in melee combats; Don't get to close.");
    }
예제 #8
0
 private void Form1_Load(object sender, EventArgs e)          //界面加载事件
 {
     logshow(TitleText);
     myDeleteage         = logshow;
     buttonDelegate      = ButtonSwitch;
     progressBarDelegate = ProgressBarShow;
 }
        public BlockingScreen(View messageView, ButtonDelegate buttonDelegate = null)
        {
            AllowsDrawPrevious = true;
            AllowsUpdatePrevious = true;

            m_delegate = buttonDelegate;

            View contentView = new RectView(0, 0, 366, 182, Color.Black, Color.White);
            contentView.x = 0.5f * width;
            contentView.y = 0.5f * height;
            contentView.alignX = contentView.alignY = View.ALIGN_CENTER;

            messageView.x = 0.5f * contentView.width;
            messageView.y = 0.5f * contentView.height;
            messageView.alignX = messageView.alignY = View.ALIGN_CENTER;
            contentView.AddView(messageView);

            Button cancelButton = new TempButton("Cancel");
            cancelButton.x = 0.5f * contentView.width;
            cancelButton.y = contentView.height - 12;
            cancelButton.alignX = View.ALIGN_CENTER;
            cancelButton.alignY = View.ALIGN_MAX;
            cancelButton.buttonDelegate = CancelButtonDelegate;
            SetCancelButton(cancelButton);

            contentView.AddView(cancelButton);

            AddView(contentView);
        }
예제 #10
0
 public void SetUI(string subject, string body, ButtonDelegate okBtnDel = null, string okBtnStr = "OK")
 {
     m_subjectLabel.text = subject;
     m_bodyLabel.text    = body;
     m_okBtnLabel.text   = okBtnStr;
     m_okBtnDel          = okBtnDel;
 }
 public static AxisDelegate CreateTriggerDelegate(ButtonDelegate del)
 {
     if (del == null)
     {
         return(null);
     }
     return(() => del() ? 1f : 0f);
 }
예제 #12
0
        /// <summary>
        /// Assigns the button delegate.
        /// </summary>
        /// <param name="bDelegate">The buttons delegate.</param>
        /// <returns></returns>
        public static bool AssignButtonDelegate(ButtonDelegate bDelegate)
        {
            if (bDelegate == null)
                return false;

            s_buttonCallback = bDelegate.Invoke;
            return true;
        }
예제 #13
0
 public bool Execute(ButtonDelegate button, AMedia media)
 {
     media.ResultEvent += ResultHandler;
     //media.ResultEvent += ResultHandlerJames;
     return(button());
     //System.Console.WriteLine(button());
     //button();h
 }
 public static InputToken CreateCustom(ButtonDelegate del)
 {
     return(new InputToken()
     {
         Type = InputType.Custom,
         _buttonDelegate = del
     });
 }
    void AddButton(string name, ButtonDelegate dele)
    {
        GameObject go     = Instantiate(cheatButtonPrefab, listTransform) as GameObject;
        Button     button = go.GetComponent <Button>();
        Text       text   = go.GetComponentInChildren <Text>();

        text.text = name;
        button.onClick.AddListener(delegate { dele(); });
    }
 public static InputToken CreateCustom(AxisDelegate axisDel, ButtonDelegate buttonDel)
 {
     return(new InputToken()
     {
         Type = InputType.Custom,
         _axisDelegate = axisDel,
         _buttonDelegate = buttonDel
     });
 }
예제 #17
0
        public void Execute(ButtonDelegate button, AMedia media)
        {
            // Console.WriteLine(media);
            // button();
            // System.Console.WriteLine(button());

            media.ResultEvent += ResultHandler;
            button();
        }
 public RepeatingButtonInputSignature(string id, ButtonDelegate btn, float repeatDelay)
     : base(id)
 {
     _button = btn;
     this.FirstRepeatDelay = repeatDelay;
     this.RepeatDelay      = repeatDelay;
     this.RepeatLerp       = 0f;
     this.MaxRepeat        = repeatDelay;
 }
        public MultiTapButton(string id, ButtonDelegate del, int taps, float delay) : base(id)
        {
            _delegate = del;
            _taps     = Mathf.Max(1, taps);
            _delay    = delay;

            _realState = ButtonState.None;
            _count     = 0;
        }
        public MultiplayerLobbyScreen(ServerInfo serverInfo, ButtonDelegate buttonDelegate, bool isServer)
        {
            this.serverInfo = serverInfo;
            viewsLookup     = new Dictionary <NetConnection, ClientInfoView>();

            View contentView = new View(512, 363);

            contentView.alignX = View.ALIGN_CENTER;
            contentView.x      = 0.5f * width;
            contentView.y      = 48;

            Font font = GetDefaultFont();

            contentView.AddView(new View(215, 145));

            TextView serverName = new TextView(font, serverInfo.name);

            serverName.alignX = View.ALIGN_CENTER;
            serverName.x      = 113;
            serverName.y      = 155;

            contentView.AddView(serverName);

            clientsView        = new View(286, contentView.height);
            clientsView.alignX = View.ALIGN_MAX;
            clientsView.x      = contentView.width;
            contentView.AddView(clientsView);

            AddView(contentView);

            View buttons = new View();

            buttons.x      = 0.5f * width;
            buttons.y      = 432;
            buttons.alignX = View.ALIGN_CENTER;
            buttons.alignY = View.ALIGN_MAX;

            Button button = new TempButton("BACK");

            button.buttonDelegate = buttonDelegate;
            button.id             = (int)ButtonId.Back;
            buttons.AddView(button);
            SetCancelButton(button);

            String   label    = isServer ? "START" : "READY";
            ButtonId buttonId = isServer ? ButtonId.Start : ButtonId.Ready;

            button = new TempButton(label);
            button.buttonDelegate = buttonDelegate;
            button.id             = (int)buttonId;
            buttons.AddView(button);

            buttons.LayoutHor(10);
            buttons.ResizeToFitViews();
            AddView(buttons);
        }
예제 #21
0
        /// <summary>
        /// Assigns the button delegate.
        /// </summary>
        /// <param name="bDelegate">The buttons delegate.</param>
        /// <returns></returns>
        public static bool AssignButtonDelegate(ButtonDelegate bDelegate)
        {
            if (bDelegate == null)
            {
                return(false);
            }

            s_buttonCallback = bDelegate.Invoke;
            return(true);
        }
예제 #22
0
 public MenuButton(String t, Color color, Color clickedColor, int x, int y, int w, int h, ButtonDelegate onClick)
 {
     text              = t;
     this.color        = color;
     this.clickedColor = clickedColor;
     width             = w;
     height            = h;
     this.x            = x;
     this.y            = y;
     this.onClick      = onClick;
 }
예제 #23
0
 /// <summary>
 /// disTwitchBtn_Click handles the event that the disconnect from Twitch button is clicked <see cref="Twitch_Controller.leaveChannel"/>
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void disTwitchBtn_Click(object sender, EventArgs e)
 {
     if (this.disTwitchBtn.InvokeRequired)
     {
         ButtonDelegate d = new ButtonDelegate(disTwitchBtn_Click);
         this.Invoke(d, new object[] { sender, e });
     }
     Twitch_Controller.Instance.leaveChannel();
     ATCBOT_View.Instance.backgroundWorker1.CancelAsync();
     setTwitchButton(true, false);
 }
예제 #24
0
 private void Button1Change(string detail)
 {
     if (this.button1_ImageSwitch.InvokeRequired == false)
     {
         this.button1_ImageSwitch.Text = detail;
     }
     else
     {
         ButtonDelegate BChangeD = new ButtonDelegate(Button1Change);
         this.button1_ImageSwitch.Invoke(BChangeD, detail);
     }
 }
예제 #25
0
 public FormPlaying(int TableIndex, int Side, StreamWriter sw)
 {
     InitializeComponent();
     this.tableIndex     = TableIndex;
     this.side           = Side;
     labelDelegate       = new LabelDelegate(SetLabel);
     buttonDelegate      = new ButtonDelegate(SetButton);
     radioButtonDelegate = new RadioButtonDelegate(SetRadioButton);
     blackBitmap         = new Bitmap(Properties.Resources.black);
     whiteBitmap         = new Bitmap(Properties.Resources.white);
     service             = new Service(listBox1, sw);
 }
        public Button AddButton(String title, int id, ButtonDelegate buttonDelegate)
        {
            Button button = new TempButton(title);
            button.id = id;
            button.buttonDelegate = buttonDelegate;
            AddView(button);

            LayoutVer(10);
            ResizeToFitViewsVer();

            return button;
        }
 public static ButtonDelegate Merge(this ButtonDelegate d1, ButtonDelegate d2)
 {
     if (d1 == null)
     {
         return(d2);
     }
     if (d2 == null)
     {
         return(d1);
     }
     return(() => d1() || d2());
 }
        public MultiplayerLobbyScreen(ServerInfo serverInfo, ButtonDelegate buttonDelegate, bool isServer)
        {
            this.serverInfo = serverInfo;
            viewsLookup = new Dictionary<NetConnection, ClientInfoView>();

            View contentView = new View(512, 363);
            contentView.alignX = View.ALIGN_CENTER;
            contentView.x = 0.5f * width;
            contentView.y = 48;

            Font font = GetDefaultFont();

            contentView.AddView(new View(215, 145));

            TextView serverName = new TextView(font, serverInfo.name);
            serverName.alignX = View.ALIGN_CENTER;
            serverName.x = 113;
            serverName.y = 155;

            contentView.AddView(serverName);

            clientsView = new View(286, contentView.height);
            clientsView.alignX = View.ALIGN_MAX;
            clientsView.x = contentView.width;
            contentView.AddView(clientsView);

            AddView(contentView);

            View buttons = new View();
            buttons.x = 0.5f * width;
            buttons.y = 432;
            buttons.alignX = View.ALIGN_CENTER;
            buttons.alignY = View.ALIGN_MAX;

            Button button = new TempButton("BACK");
            button.buttonDelegate = buttonDelegate;
            button.id = (int)ButtonId.Back;
            buttons.AddView(button);
            SetCancelButton(button);

            String label = isServer ? "START" : "READY";
            ButtonId buttonId = isServer ? ButtonId.Start : ButtonId.Ready;

            button = new TempButton(label);
            button.buttonDelegate = buttonDelegate;
            button.id = (int)buttonId;
            buttons.AddView(button);

            buttons.LayoutHor(10);
            buttons.ResizeToFitViews();
            AddView(buttons);
        }
예제 #29
0
        /// <summary>
        /// Map a given delegate
        /// </summary>
        /// <param name="del">the delegate to set</param>
        /// <param name="function">the function which the delegate will perform</param>
        protected void Map(ref ButtonDelegate del, string function)
        {
            if (function != null)
            {
                switch (function.ToUpperInvariant())
                {
                case "PLAY_PAUSE":
                    del = delegate() { PlayPause(); };
                    break;

                case "TOGGLE_REPEAT":
                    del = delegate() { wsc.SendRequest("playback", "toggleRepeat"); };
                    break;

                case "TOGGLE_SHUFFLE":
                    del = delegate() { wsc.SendRequest("playback", "toggleShuffle"); };
                    break;

                case "INCREASE_VOLUME":
                    del = delegate() { wsc.SendRequest("volume", "increaseVolume"); };
                    break;

                case "DECREASE_VOLUME":
                    del = delegate() { wsc.SendRequest("volume", "decreaseVolume"); };
                    break;

                case "BACK":
                    del = delegate() { wsc.SendRequest("playback", "rewind"); };
                    break;

                case "FORWARD":
                    del = delegate() { wsc.SendRequest("playback", "forward"); };
                    break;

                case "TOGGLE_THUMBS_UP":
                    del = delegate() { wsc.SendRequest("rating", "toggleThumbsUp"); };
                    break;

                case "TOGGLE_THUMBS_DOWN":
                    del = delegate() { wsc.SendRequest("rating", "toggleThumbsDown"); };
                    break;

                default:
                    del = delegate() { PlayPause(); };
                    break;
                }
            }
            else
            {
                del = delegate() { PlayPause(); };
            }
        }
예제 #30
0
 public static void showButton(GuiUtilButton hb, bool enabled, string name, ButtonDelegate cb, GUIStyle style)
 {
     if (enabled)
     {
         style.normal.background = hb.enabled;
         showButton(hb.rect, name, style, true, cb);
     }
     else
     {
         style.normal.background = hb.disabled;
         showButton(hb.rect, name, style, true, delegate(Object o){});
     }
 }
예제 #31
0
        public Button AddButton(String title, int id, ButtonDelegate buttonDelegate)
        {
            Button button = new TempButton(title);

            button.id             = id;
            button.buttonDelegate = buttonDelegate;
            AddView(button);

            LayoutVer(10);
            ResizeToFitViewsVer();

            return(button);
        }
예제 #32
0
 public FormPlaying(int TableIndex, int Side, StreamWriter sw)
 {
     InitializeComponent();
     this.tableIndex = TableIndex;
     this.side = Side;
     this.color = side;
     labelDelegate = new LabelDelegate(SetLabel);
     buttonDelegate = new ButtonDelegate(SetButton);
     radioButtonDelegate = new RadioButtonDelegate(SetRadioButton);
     blackBitmap = new Bitmap(Properties.Resources.black);
     whiteBitmap = new Bitmap(Properties.Resources.white);
     service = new Service(listBox1, sw);
 }
예제 #33
0
	public UiPopupInfo (
		string title,
		string content,
		string buttonText,
		float buttonWidth,
		ButtonDelegate buttonAction) {

		Title = title;
		Content = content;
		ButtonText = buttonText;
		ButtonWidth = buttonWidth;
		ButtonAction = buttonAction;
	}
예제 #34
0
        public MainMenuScreen(ButtonDelegate buttonDelegate)
            : base((int)MenuController.ScreenID.MainMenu)
        {
            Font font = Helper.fontButton;

            View rootView = new View();

            TextButton button = new TempButton("Play");

            button.id             = (int)ButtonId.Play;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            button                = new TempButton("Test");
            button.id             = (int)ButtonId.Test;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            button                = new TempButton("Join server");
            button.id             = (int)ButtonId.DebugStartClient;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            button                = new TempButton("Start server");
            button.id             = (int)ButtonId.DebugStartServer;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            //button = new TempButton("Multiplayer", font, 0, 0, w, h);
            //button.id = (int)ButtonId.Multiplayer;
            //button.SetDelegate(buttonDelegate);
            //rootView.AddView(button);

            button                = new TempButton("Settings");
            button.id             = (int)ButtonId.Settings;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            button                = new TempButton("Exit");
            button.id             = (int)ButtonId.Exit;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            rootView.LayoutVer(20);
            rootView.ResizeToFitViews();

            AddView(rootView);

            rootView.x = 0.5f * (width - rootView.width);
            rootView.y = 0.5f * (height - rootView.height);
        }
        public MainMenuScreen(ButtonDelegate buttonDelegate)
            : base((int)MenuController.ScreenID.MainMenu)
        {
            Font font = Helper.fontButton;

            View rootView = new View();

            TextButton button = new TempButton("Play");
            button.id = (int)ButtonId.Play;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            button = new TempButton("Test");
            button.id = (int)ButtonId.Test;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            button = new TempButton("Join server");
            button.id = (int)ButtonId.DebugStartClient;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            button = new TempButton("Start server");
            button.id = (int)ButtonId.DebugStartServer;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            //button = new TempButton("Multiplayer", font, 0, 0, w, h);
            //button.id = (int)ButtonId.Multiplayer;
            //button.SetDelegate(buttonDelegate);
            //rootView.AddView(button);

            button = new TempButton("Settings");
            button.id = (int)ButtonId.Settings;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            button = new TempButton("Exit");
            button.id = (int)ButtonId.Exit;
            button.buttonDelegate = buttonDelegate;
            rootView.AddView(button);

            rootView.LayoutVer(20);
            rootView.ResizeToFitViews();

            AddView(rootView);

            rootView.x = 0.5f * (width - rootView.width);
            rootView.y = 0.5f * (height - rootView.height);
        }
예제 #36
0
        public void SetConfirmButton(Button button)
        {
            confirmButton = button;

            if (button != null)
            {
                confirmButtonDelegate = button.buttonDelegate;
                button.buttonDelegate = OnConfirmButtonPress;
            }
            else
            {
                confirmButtonDelegate = null;
            }
        }
예제 #37
0
        protected internal Button(float xCenter, float yCenter, ButtonDelegate buttonClickedAction,
                                  Sprite backgroundSprite             = null, string text = null,
                                  ButtonDelegate buttonReleasedAction = null, bool drawInBlack = false)
        {
            _backgroundSprite = backgroundSprite == null?
                                GameData.GraphicsFactory.CreateButtonBackgroundSprite(xCenter, yCenter) : backgroundSprite;

            if (text != null)
            {
                _text = GameData.GraphicsFactory.CreateDrawableText(xCenter, yCenter, text, drawInBlack);
            }
            buttonClicked  += buttonClickedAction;
            buttonReleased += buttonReleasedAction;
        }
        public PauseScreen(ButtonDelegate buttonDelegate)
        {
            AllowsDrawPrevious = true;

            Color backColor = new Color(0.0f, 0.0f, 0.0f, 0.25f);
            AddView(new RectView(0, 0, width, height, backColor, Color.Black));

            ButtonGroup group = new ButtonGroup();
            Button resumeButton = group.AddButton("Resume", (int)ButtonId.Resume, buttonDelegate);
            group.AddButton("Exit", (int)ButtonId.Exit, buttonDelegate);
            group.alignX = group.alignY = View.ALIGN_CENTER;
            group.x = 0.5f * width;
            group.y = 0.5f * height;
            AddView(group);

            SetCancelButton(resumeButton);
        }
        public GameResultScreen(Game game, ButtonDelegate buttonDelegate)
        {
            Font font = Helper.fontButton;
            TextView text = new TextView(font, "GAME ENDED");
            text.alignX = View.ALIGN_CENTER;
            text.alignY = View.ALIGN_CENTER;
            text.x = 0.5f * width;
            text.y = 0.5f * height;

            Button button = new TempButton("EXIT");
            button.alignX = View.ALIGN_CENTER;
            button.buttonDelegate = buttonDelegate;
            button.id = (int)ButtonId.Exit;
            button.x = 0.5f * width;
            button.y = text.y + 50;
            AddView(button);

            SetCancelButton(button);
        }
        public static ButtonDelegate[] GetButtons()
        {
            //Get PQS
            int numPQS = 0;
            foreach( PQS pqs in GameObject.FindObjectsOfType(typeof( PQS )) )
            {
                numPQS++;
            }
            ButtonDelegate[] delgates = new ButtonDelegate[numPQS + 2];

            //Populate lists
            int i;
            for( i = 0; i < numPQS; i++ )
            {
                delgates[i] = Button_Select;
            }
            //i++;
            delgates[i] = UpdatePQSList;

            return delgates;
        }
        public SettingsScreen(ButtonDelegate buttonDelegate)
            : base((int)MenuController.ScreenID.Settings)
        {
            Font font = Helper.fontButton;

            View rootView = new View();
            rootView.alignX = rootView.alignY = View.ALIGN_CENTER;

            TextButton button = new TempButton("Back");
            button.id = (int)ButtonId.Back;
            button.buttonDelegate = OnButtonPressed;
            rootView.AddView(button);

            rootView.LayoutVer(20);
            rootView.ResizeToFitViewsVer();

            AddView(rootView);

            rootView.x = 0.5f * width;
            rootView.y = 0.5f * height;
        }
예제 #42
0
 public void addClickHandler(ButtonDelegate onButtonClicked)
 {
     _onButtonClicked = onButtonClicked;
 }
예제 #43
0
 public Button(string title, ButtonDelegate buttonDelegate)
     : base(title)
 {
     ButtonDelegate = buttonDelegate;
 }
예제 #44
0
        internal void ApplyConfiguration(Configuration appliedConfiguration, bool refreshPlayer, bool force)
        {
            try
            {
                bool isAudioscrobblerUpdated = false;
                bool isProxyUpdated = false;

                if (this.configuration.LastFmSubmit != appliedConfiguration.LastFmSubmit ||
                    this.configuration.LastFmUser != appliedConfiguration.LastFmUser ||
                    this.configuration.LastFmPassword != appliedConfiguration.LastFmPassword)
                {
                    isAudioscrobblerUpdated = true;
                }

                if (configuration.ProxyHost != appliedConfiguration.ProxyHost ||
                    configuration.ProxyPort != appliedConfiguration.ProxyPort ||
                    configuration.ProxyUser != appliedConfiguration.ProxyUser ||
                    configuration.ProxyPassword != appliedConfiguration.ProxyPassword)
                {
                    isProxyUpdated = true;
                }

                if (force)
                {
                    isAudioscrobblerUpdated = true;
                    isProxyUpdated = true;
                }

                //
                // Apply

                this.configuration.Apply(appliedConfiguration);

                try
                {
                    //
                    // Title buttons

                    this.btnClose.Visible = this.configuration.CloseButtonVisible;
                    this.btnMinimize.Visible = this.configuration.MinimizeButtonVisible;

                    //
                    // Window

                    this.TopMost = this.configuration.KeepOnTop;
                    settingsForm.TopMost = this.configuration.KeepOnTop;

                    //
                    // Tool tip

                    if (this.configuration.CloseButtonMinimizeToTray)
                    {
                        toolTip.SetToolTip(this.btnClose, "Close (Minimize to Tray)");
                    }
                    else
                    {
                        toolTip.SetToolTip(this.btnClose, "Close (Exit)");
                    }

                    toolTip.SetToolTip(this.btnMinimize, "Minimize");

                    //
                    // G15

                    if (configuration.SendToG15 && g15 == null)
                    {
                        Debug.WriteLine("Connecting to G15");

                        g15 = new G15();

                        // first define some delegates
                        bDelegate = new ButtonDelegate(this.ButtonDelegateImplementation);
                        cDelegate = new ConfigureDelegate(this.ConfigureDelegateImplementation);

                        g15.SetButtonDelegateImplementation(bDelegate);
                        g15.SetConfigureDelegateImplementation(cDelegate);
                        g15.OpenLCD();
                    }
                    else if (!configuration.SendToG15 && g15 != null)
                    {
                        g15.CloseLCD();
                        g15 = null;
                    }

                    //
                    // Refresh player

                    if (song.Name != string.Empty)
                    {
                        refreshMessenger = true;
                        refreshXfire = true;
                        refreshSkype = true;
                        refreshG15 = true;
                    }

                    if (refreshPlayer)
                    {
                        RefreshPlayer(false);
                    }

                    //
                    // Audioscrobbler

                    if ((isAudioscrobblerUpdated || isProxyUpdated || audioscrobbler == null) &&
                        configuration.LastFmSubmit &&
                        configuration.LastFmUser != string.Empty)
                    {
                        if (audioscrobbler != null)
                        {
                            audioscrobbler.Connected -= new EventHandler(this.AudioscrobblerConnected);
                        }

                        audioscrobbler = new Audioscrobbler("opa", "0.1", configuration.LastFmUser, configuration.LastFmPassword);

                        audioscrobbler.Connected += new EventHandler(this.AudioscrobblerConnected);
                        audioscrobbler.ConnectionFailed += new EventHandler(this.AudioscrobblerConnectionFailed);

                        audioscrobbler.Connect(
                            configuration.ProxyHost,
                            configuration.ProxyPort,
                            configuration.ProxyUser,
                            configuration.ProxyPassword);
                    }

                    if (configuration.LastFmSubmit && configuration.LastFmSubmitManual)
                    {
                        menuLastFmSubmit.Visible = true;
                    }
                    else
                    {
                        menuLastFmSubmit.Visible = false;
                    }

                    //
                    // Proxy

                    if (isProxyUpdated)
                    {
                        LoadStations();
                    }
                }
                finally
                {
                    this.configuration.Save();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
        public RoundResultScreen(Game game, ButtonDelegate buttonDelegate)
        {
            View contentView = new View(64, 48, 512, 384);

            // table
            View tableView = new View(0, 25, contentView.width, 330);

            float nameColWidth = 320;
            float winsColWidth = 0.5f * (tableView.width - nameColWidth);
            float suicidesColWidth = winsColWidth;

            Font font = Helper.fontButton;

            TextView textView = new TextView(font, "PLAYER");
            textView.alignX = View.ALIGN_CENTER;
            textView.x = 0.5f * nameColWidth;
            tableView.AddView(textView);

            textView = new TextView(font, "WINS");
            textView.alignX = View.ALIGN_CENTER;
            textView.x = nameColWidth + 0.5f * winsColWidth;
            tableView.AddView(textView);

            textView = new TextView(font, "SUICIDES");
            textView.alignX = View.ALIGN_CENTER;
            textView.x = nameColWidth + winsColWidth + 0.5f * suicidesColWidth;
            tableView.AddView(textView);

            List<Player> players = game.GetPlayersList();
            float px = 0.5f * nameColWidth;
            float py = textView.y + textView.height + 10;
            for (int i = 0; i < players.Count; ++i)
            {
                PlayerResultView pv = new PlayerResultView(players[i]);
                pv.alignX = View.ALIGN_CENTER;
                pv.x = px;
                pv.y = py;

                tableView.AddView(pv);

                py += pv.height + 10;
            }

            contentView.AddView(tableView);

            // buttons
            View buttons = new View(0.5f * contentView.width, contentView.height, 0, 0);
            buttons.alignX = View.ALIGN_CENTER;
            buttons.alignY = View.ALIGN_MAX;

            Button button = new TempButton("EXIT");
            button.id = (int)ButtonId.Exit;
            button.buttonDelegate = buttonDelegate;
            SetCancelButton(button);
            buttons.AddView(button);

            button = new TempButton("START!");
            button.id = (int)ButtonId.Continue; ;
            button.buttonDelegate = buttonDelegate;
            FocusView(button);

            SetConfirmButton(button);
            buttons.AddView(button);

            buttons.LayoutHor(20);
            buttons.ResizeToFitViews();
            contentView.AddView(buttons);

            AddView(contentView);
        }
예제 #46
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Lcdisplay"/> class.
        /// </summary>
        private Lcdisplay()
        {
            m_defaultFont = FontFactory.GetFont("Microsoft Sans Serif", 13.5f, FontStyle.Regular, GraphicsUnit.Point);

            m_bmpLCD = new Bitmap(G15Width, G15Height, PixelFormat.Format24bppRgb);
            m_bmpLCD.SetResolution(G15DpiX, G15DpiY);
            m_lcdCanvas = Graphics.FromImage(m_bmpLCD);
            m_lcdCanvas.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;

            m_bmpLCDX = new Bitmap(G15Width, G15Height, PixelFormat.Format24bppRgb);
            m_bmpLCDX.SetResolution(G15DpiX, G15DpiY);
            m_lcdOverlay = Graphics.FromImage(m_bmpLCDX);
            m_lcdOverlay.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;

            m_buttonStateHld = DateTime.Now;
            m_cycleTime = DateTime.Now.AddSeconds(10);
            m_cycleQueueInfoTime = DateTime.Now.AddSeconds(5);
            m_showingCycledQueueInfo = false;

            Cycle = false;
            ShowSystemTime = false;
            CycleSkillQueueTime = false;
            FirstSkillCompletionRemaingTime = TimeSpan.FromTicks(DateTime.Now.Ticks);

            m_buttonDelegate = new ButtonDelegate(OnButtonsPressed);
            LCDInterface.AssignButtonDelegate(m_buttonDelegate);
            LCDInterface.Open("EVEMon", false);
        }
 public void UpdateHandler(ButtonDelegate delegateFunction)
 {
     confirmButton.onClick.RemoveAllListeners ();
     confirmButton.onClick.AddListener(() => delegateFunction ());
 }
        public static ButtonDelegate[] GetButtons()
        {
            //Get PQS
            int numFiles = 0;

            List<string> FileNames = new List<string>();

            DirectoryInfo directory = new DirectoryInfo( "GameInfo/KittopiaSpace/Textures/"+ PlanetName +"/PQS/" );
            var files = directory.GetFiles("*.png");
            foreach( FileInfo f in files )
            {
                FileNames.Add( f.Name );
                numFiles++;
            }

            ButtonDelegate[] delgates = new ButtonDelegate[numFiles + 2];

            //Populate lists
            int i;
            for( i = 0; i < numFiles; i++ )
            {
                delgates[i] = Button_Select;
            }
            //i++;
            delgates[i] = Button_Select;

            return delgates;
        }
예제 #49
0
        public void SetCancelButton(Button button)
        {
            cancelButton = button;

            if (button != null)
            {
                cancelButtonDelegate = button.buttonDelegate;
                button.buttonDelegate = OnCancelButtonPress;
            }
            else
            {
                cancelButtonDelegate = null;
            }
        }
 public BlockingScreen(String text, ButtonDelegate buttonDelegate = null)
     : this(new TextView(Helper.fontButton, text), buttonDelegate)
 {
 }
예제 #51
0
        public void SetConfirmButton(Button button)
        {
            confirmButton = button;

            if (button != null)
            {
                confirmButtonDelegate = button.buttonDelegate;
                button.buttonDelegate = OnConfirmButtonPress;
            }
            else
            {
                confirmButtonDelegate = null;
            }
        }
        public PlayersScreen(Scheme scheme, InputType[] inputTypes, InputTypeSelectDelegate selectDelegate, ButtonDelegate buttonDelegate)
        {
            View contentView = new View(64, 48, 521, 363);

            // scheme view
            contentView.AddView(new SchemeView(scheme, SchemeView.Style.Large));

            // input type selector
            int maxPlayers = inputTypes.Length;
            View inputTypeContainer = new View(226, 0, 286, 0);
            Font font = Helper.fontButton;
            for (int i = 0; i < maxPlayers; ++i)
            {
                InputTypeView typeView = new InputTypeView(i, inputTypes[i], font, inputTypeContainer.width, font.FontHeight());
                typeView.selectDelegate = selectDelegate;
                inputTypeContainer.AddView(typeView);
            }
            inputTypeContainer.LayoutVer(0);
            inputTypeContainer.ResizeToFitViewsHor();
            contentView.AddView(inputTypeContainer);

            AddView(contentView);

            // buttons
            View buttons = new View(0.5f * width, contentView.y + contentView.height, 0, 0);
            buttons.alignX = View.ALIGN_CENTER;

            Button button = new TempButton("BACK");
            button.id = (int)ButtonId.Back;
            button.buttonDelegate = buttonDelegate;
            SetCancelButton(button);
            buttons.AddView(button);

            button = new TempButton("START!");
            button.id = (int)ButtonId.Start;
            button.buttonDelegate = buttonDelegate;
            FocusView(button);
            SetConfirmButton(button);
            buttons.AddView(button);

            buttons.LayoutHor(20);
            buttons.ResizeToFitViews();
            AddView(buttons);
        }
예제 #53
0
 public ToolBarButton(string title, ButtonDelegate buttonDelegate)
     : base(title, buttonDelegate)
 {
     Width = SharedStyles.MeasureWidth(SharedStyles.toolbarButton, title);
 }
예제 #54
0
 public ToolBarButton AddButton(string title, ButtonDelegate buttonDelegate)
 {
     ToolBarButton button = new ToolBarButton(title, buttonDelegate);
     AddSubview(button);
     return button;
 }
        public MultiplayerScreen(ButtonDelegate buttonDelegate)
        {
            this.buttonDelegate = buttonDelegate;

            Font font = Helper.fontButton;

            TextView headerText = new TextView(font, "LOCAL SERVERS");
            headerText.alignX = View.ALIGN_CENTER;
            headerText.x = 0.5f * width;
            headerText.y = 31;
            AddView(headerText);

            contentView = new View(467, 333);
            contentView.alignX = View.ALIGN_CENTER;
            contentView.x = 0.5f * width;
            contentView.y = 73;
            contentView.visible = false;
            AddView(contentView);

            busyView = new View(467, 333);
            busyView.alignX = View.ALIGN_CENTER;
            busyView.x = 0.5f * width;
            busyView.y = 73;

            TextView busyText = new TextView(font, "Searching for local servers...");
            busyText.alignX = busyText.alignY = View.ALIGN_CENTER;
            busyText.x = 0.5f * busyView.width;
            busyText.y = 0.5f * busyView.height;
            busyView.AddView(busyText);

            AddView(busyView);

            View buttonGroup = new View();

            Button button = new TempButton("BACK");
            button.buttonDelegate = buttonDelegate;
            button.id = (int)ButtonId.Back;
            buttonGroup.AddView(button);
            SetCancelButton(button);

            button = new TempButton("REFRESH");
            button.buttonDelegate = buttonDelegate;
            button.id = (int)ButtonId.Refresh;
            buttonGroup.AddView(button);

            button = new TempButton("CREATE");
            button.buttonDelegate = buttonDelegate;
            button.id = (int)ButtonId.Create;
            buttonGroup.AddView(button);

            buttonGroup.LayoutHor(10);
            buttonGroup.ResizeToFitViews();

            buttonGroup.alignX = View.ALIGN_CENTER;
            buttonGroup.alignY = View.ALIGN_MAX;

            buttonGroup.x = 0.5f * width;
            buttonGroup.y = 432;

            AddView(buttonGroup);
        }
예제 #56
0
 public void SetButtonDelegateImplementation(ButtonDelegate bDelegate)
 {
     lcd.AssignButtonDelegate(bDelegate);
 }