Example #1
0
    void LateUpdate()
    {
        if (viewpoint != null)
        {
            float factor = Mathf.Min(1.0f, Time.deltaTime * 7.0f);
            mTrans.position = Vector3.Lerp(mTrans.position, viewpoint.position, factor);
            mTrans.rotation = Quaternion.Slerp(mTrans.rotation, viewpoint.rotation, factor);
            mLerpSpeed = 0f;
        }
        else if (!mMouseHeld && !allowInput)
        {
            allowInput = true;
        }
        else
        {
            ProcessInput();
            onClick = null;

            // Lerp speed is interpolated so that the camera exits 'viewpoint focus' mode smoothly
            mLerpSpeed = Mathf.Lerp(mLerpSpeed, 1f, Mathf.Clamp01(Time.deltaTime * 5f));

            // Lerp the 'look at' position
            float factor = Mathf.Clamp01(Time.deltaTime * 20.0f * mLerpSpeed);
            mPos = Vector3.Lerp(mPos, followPos, factor);

            float angleX = angleCurve.Evaluate(mDolly.x);
            Quaternion targetRot = Quaternion.Euler(angleX, mAngleY, 0.0f);

            // Lerp the final position and rotation of the camera, offset by the dolly distance
            Vector3 offset = Vector3.forward * distanceCurve.Evaluate(mDolly.x);
            mTrans.position = Vector3.Lerp(mTrans.position, mPos - targetRot * offset, factor);
            mTrans.rotation = Quaternion.Slerp(mTrans.rotation, targetRot, factor);
        }
    }
Example #2
0
 // add onClick
 public void AddOnClick(OnClick clickFunc)
 {
     if (onClick == null)
         onClick = clickFunc;
     else
         onClick += clickFunc;
 }
 public CharacterSelectMenuScreen()
 {
     this.playerName = new TextBox();
     this.characterName = new TextBox();
     this.buttons = new Button[4];
     OnClick c = new OnClick(ButtonClickEvents.KnightKlick);
     this.InitializeButton(0, "Knight", "Knight", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 270, c);
     c = new OnClick(ButtonClickEvents.MarksmanKlick);
     this.InitializeButton(1, "Marksman", "Marksman", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 350, c);
     c = new OnClick(ButtonClickEvents.MageKlick);
     this.InitializeButton(2, "Mage", "Mage", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 430, c);
     c = new OnClick(ButtonClickEvents.ToMainMenuClick);
     this.InitializeButton(3, "Back", "Back", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 510, c);
     this.playerName.Name = "Player";
     this.playerName.Text = "PlayerName";
     this.playerName.BackColor = Color.DarkGray;
     this.playerName.Width = 130;
     this.playerName.Height = 53;
     this.playerName.Location = new System.Drawing.Point((Screen.PrimaryScreen.Bounds.Width / 2 + 125), 270);
     this.characterName.Name = "Character";
     this.characterName.Text = "CharacterName";
     this.characterName.BackColor = Color.DarkGray;
     this.characterName.Width = 130;
     this.characterName.Height = 53;
     this.characterName.Location = new System.Drawing.Point((Screen.PrimaryScreen.Bounds.Width / 2 + 125), 330);
 }
Example #4
0
 public GHitspot(int X, int Y, int Width, int Height, OnClick Target)
     : base(X, Y)
 {
     this.m_Width = Width;
     this.m_Height = Height;
     this.m_Target = Target;
 }
Example #5
0
        public Button(OnClick onClickMethod, Rectangle position, string caption)
        {
            // Save click method and initialise state variables.
            mOnClickMethod = onClickMethod;
            mHovered = false;
            mVisible = true;
            mEnabled = true;
            mMarked = false;

            // Load texture and save information about its appearance.
            mBackground = Core.Content.Load<Texture2D>("Textures/button");
            mPosition = position;
            mTint = Color.White;
            mHighlight = new Color(2, 84, 85, 255);

            // Save caption, its colour, position and load the font.
            mCaption = caption;
            mTextColour = Color.Ivory;
            mFont = Core.Content.Load<SpriteFont>("Fonts/button");

            Vector2 textSize = mFont.MeasureString(mCaption);
            mTextPos = new Vector2(mPosition.X + (mPosition.Width - textSize.X) * 0.5f,
                                   mPosition.Y + (mPosition.Height - textSize.Y) * 0.5f);
            mTextShadowPos = mTextPos + new Vector2(2, 2);
        }
Example #6
0
 // this is called by storage
 public void Init(UIStorageBase sb, int id, OnClick clickFunc)
 {
     slot_id = id;
     storage = sb;
     AddOnClick(clickFunc);
     // more here
 }
Example #7
0
 public LoadMenuScreen()
 {
     this.buttons = new Button[5];
     OnClick c = new OnClick(ButtonClickEvents.LoadSlot1Click);
     this.InitializeButton(0, "Slot1", "Slot 1", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 270, c);
     c = new OnClick(ButtonClickEvents.LoadSlot2Click);
     this.InitializeButton(1, "Slot2", "Slot 2", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 350, c);
     c = new OnClick(ButtonClickEvents.LoadSlot3Click);
     this.InitializeButton(2, "Slot3", "Slot 3", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 430, c);
     c = new OnClick(ButtonClickEvents.LoadMenuBackClick);
     this.InitializeButton(3, "Back", "Back", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 510, c);
     c = new OnClick(ButtonClickEvents.ToMainMenuClick);
     this.InitializeButton(4, "ExitToMainMenu", "Exit to Main Menu", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 590, c);
     MenuEntered += this.OnMenuEntered;
     this.playerSlots = new string[3][];
     this.slots = new int[3][];
     for (int i = 0; i < 3; i++)
     {
         this.playerSlots[i] = new string[3];
         this.slots[i] = new int[31 * 19];
     }
 }
Example #8
0
 private GSystemButton AddButton(string name, int x, int y, int w, int h, OnClick onClick)
 {
     GSystemButton toAdd = new GSystemButton(x, y, w, h, SystemColors.Control, SystemColors.ControlText, name, Engine.GetUniFont(2)) {
         OnClick = onClick
     };
     base.Client.Children.Add(toAdd);
     return toAdd;
 }
Example #9
0
 private GWindowsButton AddButton(string name, int index, OnClick onClick)
 {
     GWindowsButton toAdd = new GWindowsButton(name, 0x103, (30 + (index * 0x19)) - 0x16, 0x2f, 0x16) {
         OnClick = onClick
     };
     base.Client.Children.Add(toAdd);
     return toAdd;
 }
        public AntennaConfigFragment(IAntenna antenna, OnClick forceClose, OnAntenna onUpdate)
        {
            mFocus = antenna;
            mForceClose = forceClose;
            mOnUpdate = onUpdate;

            RTCore.Instance.Antennas.Unregistered += OnAntenna;

            RebuildTargetList();
        }
Example #11
0
 public void RegisterOnCharacterClick(OnClick callback)
 {
     foreach (var rendable in GetRendables()) {
         var button = rendable as GameButton;
         if (button != null)
         {
             button.RegisterOnClick(callback);
         }
     }
 }
Example #12
0
 public GFlatButton(int X, int Y, int Width, int Height, string Text, OnClick OnClick)
     : base(X, Y, Width, Height)
 {
     this.m_OnClick = OnClick;
     base.m_CanDrag = false;
     GTextButton toAdd = new GTextButton(Text, Engine.GetUniFont(0), Hues.Default, Hues.Load(0x35), 0, 0, new OnClick(this.Route_OnClick));
     base.m_Children.Add(toAdd);
     toAdd.Center();
     base.m_Children.Add(new GHotspot(0, 0, Width, Height, toAdd));
 }
Example #13
0
        public BehaviorModel(UCWebBrowserEx wb, BeforeAddBehavior methodBeforeAddBehavior, AfterAddBehavior methodAfterAddBehavior, ThrowException methodThrowException, OnClick methodOnClick, MouseOverOnBrowser methodMouseOverOnBrowser)
        {
            this._webBrowser = wb;
            this._methodBeforeAddBehavior = methodBeforeAddBehavior;
            this._methodAfterAddBehavior = methodAfterAddBehavior;
            this._methodThrowException = methodThrowException;
            this._methodClick = methodOnClick;
            this._methodMouseOverOnBrowser = methodMouseOverOnBrowser;

            this.AttachEvent();
        }
Example #14
0
 protected void InitializeButton(int index, string name, string text, int width, int height, int startX, int startY, OnClick click)
 {
     buttons[index] = new Button();
     buttons[index].Name = name;
     buttons[index].Text = text;
     buttons[index].BackColor = Color.DarkGray;
     buttons[index].Size = new System.Drawing.Size(width, height);
     buttons[index].Location = new System.Drawing.Point(startX, startY);
     buttons[index].Anchor = AnchorStyles.Left;
     buttons[index].Visible = true;
     buttons[index].Click += new EventHandler(click);
 }
        public SatelliteConfigFragment(VesselSatellite vs, OnClick forceClose, OnAntenna onClick)
        {
            mForceClose = forceClose;
            mOnClick = onClick;

            mFocus = vs;
            RebuildAntennaList();

            RTCore.Instance.Antennas.Registered += OnAntenna;
            RTCore.Instance.Antennas.Unregistered += OnAntenna;
            RTCore.Instance.Satellites.Unregistered += OnSatellite;
        }
Example #16
0
 public GButton(int NormalID, int OverID, int PressedID, int X, int Y, OnClick ClickHandler)
     : base(X, Y)
 {
     this.m_fAlpha = 1f;
     this.m_GumpID = new int[] { NormalID, OverID, PressedID };
     this.m_Gump = new Texture[3];
     this.m_Draw = new bool[3];
     IHue hue = Hues.Default;
     for (int i = 0; i < 3; i++)
     {
         this.m_Gump[i] = hue.GetGump(this.m_GumpID[i]);
         this.m_Draw[i] = (this.m_Gump[i] != null) && !this.m_Gump[i].IsEmpty();
     }
     this.m_OnClick = ClickHandler;
     this.Enabled = this.m_OnClick != null;
     base.m_ITranslucent = true;
 }
Example #17
0
 public GQuickHues(GHuePicker Picker, GBrightnessBar Brightness, GFlatButton Okay)
     : base(3, 0x57, 0x76, 20)
 {
     this.m_CompactHeight = 20;
     this.m_ExpandedHeight = Engine.GameHeight / 2;
     this.m_Picker = Picker;
     this.m_Brightness = Brightness;
     this.m_Okay = Okay;
     base.m_CanDrag = false;
     this.m_Timer = new Timer(new OnTick(this.Roll_OnTick), 0);
     GLabel toAdd = new GLabel("Quick Hues", Engine.GetUniFont(0), Hues.Default, 2, 2);
     this.Height = 20;
     this.m_CompactHeight = base.m_Height;
     base.m_Children.Add(toAdd);
     toAdd.Center();
     QuickHues.Load();
     int count = QuickHues.Entries.Count;
     int num2 = 0x16;
     Clipper clipper = new Clipper(base.m_X + 1, base.m_Y + 1, base.m_Width - 2, base.m_Height - 2);
     GTextButton button = new GTextButton("Create new..", Engine.GetUniFont(0), Hues.Default, Hues.Load(0x35), 2, 2, new OnClick(this.Add_OnClick));
     base.m_Children.Add(button);
     button.Center();
     button.Y = num2;
     button.Scissor(clipper);
     num2 += button.Height;
     OnClick onClick = new OnClick(this.Entry_OnClick);
     OnHighlight highlight = new OnHighlight(this.Entry_OnHighlight);
     for (int i = 0; i < count; i++)
     {
         QuickHueEntry entry = (QuickHueEntry) QuickHues.Entries[i];
         GTextButton button2 = new GTextButton(entry.Name, Engine.GetUniFont(0), Hues.Load(0x58), Hues.Load(0x35), 2, 2, onClick);
         base.m_Children.Add(button2);
         button2.Center();
         button2.Y = num2;
         button2.Scissor(clipper);
         button2.SetTag("HueID", entry.Hue);
         button2.SetTag("Index", i);
         num2 += button2.Height;
         button2.OnHighlight = highlight;
         button2.Tooltip = new Tooltip(string.Format("0x{0:X}", entry.Hue));
     }
     num2 += 2;
     this.m_ExpandedHeight = num2;
 }
Example #18
0
 public GCombatGump()
     : base(0x2b02, 50, 50)
 {
     AbilityInfo[] abilities = AbilityInfo.Abilities;
     AbilityInfo active = AbilityInfo.Active;
     AbilityInfo primary = AbilityInfo.Primary;
     AbilityInfo secondary = AbilityInfo.Secondary;
     IFont uniFont = Engine.GetUniFont(1);
     OnClick onClick = new OnClick(this.Name_OnClick);
     GLabel toAdd = new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 100, 4);
     base.m_Children.Add(toAdd);
     toAdd = new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x106, 4);
     base.m_Children.Add(toAdd);
     for (int i = 0; i < abilities.Length; i++)
     {
         AbilityInfo a = abilities[i];
         IHue hueFor = GetHueFor(a);
         toAdd = new GTextButton(Localization.GetString(a.Name), uniFont, hueFor, hueFor, 0x38 + ((i / 9) * 0xa2), 0x26 + ((i % 9) * 15), onClick);
         a.NameLabel = (GTextButton) toAdd;
         toAdd.SetTag("Ability", a);
         toAdd.Tooltip = new Tooltip(Localization.GetString(a.Tooltip), true, 240);
         toAdd.Tooltip.Delay = 0.25f;
         base.m_Children.Add(toAdd);
     }
     this.m_PrimaryIcon = new GAbilityIcon(true, true, primary.Icon, 0xda, 0x69);
     this.m_PrimaryIcon.Tooltip = new Tooltip(Localization.GetString(primary.Name), true);
     this.m_PrimaryIcon.Tooltip.Delay = 0.25f;
     this.m_PrimaryIcon.Hue = (primary == AbilityInfo.Active) ? Hues.Load(0x8026) : Hues.Default;
     base.m_Children.Add(this.m_PrimaryIcon);
     toAdd = new GLabel("Primary", Engine.GetFont(6), Hues.Default, 0x10c, 0x69);
     base.m_Children.Add(toAdd);
     toAdd = new GLabel("Ability Icon", Engine.GetFont(6), Hues.Default, 0x10c, 0x77);
     base.m_Children.Add(toAdd);
     this.m_SecondaryIcon = new GAbilityIcon(true, false, secondary.Icon, 0xda, 150);
     this.m_SecondaryIcon.Tooltip = new Tooltip(Localization.GetString(secondary.Name), true);
     this.m_SecondaryIcon.Tooltip.Delay = 0.25f;
     this.m_SecondaryIcon.Hue = (secondary == AbilityInfo.Active) ? Hues.Load(0x8026) : Hues.Default;
     base.m_Children.Add(this.m_SecondaryIcon);
     toAdd = new GLabel("Secondary", Engine.GetFont(6), Hues.Default, 0x10c, 150);
     base.m_Children.Add(toAdd);
     toAdd = new GLabel("Ability Icon", Engine.GetFont(6), Hues.Default, 0x10c, 0xa4);
     base.m_Children.Add(toAdd);
 }
Example #19
0
 public SaveMenuScreen()
 {
     this.buttons = new Button[5];
     OnClick c = new OnClick(ButtonClickEvents.SaveToSlot1Click);
     this.InitializeButton(0, "Slot1", "Slot 1", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 270, c);
     c = new OnClick(ButtonClickEvents.SaveToSlot2Click);
     this.InitializeButton(1, "Slot2", "Slot 2", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 350, c);
     c = new OnClick(ButtonClickEvents.SaveToSlot3Click);
     this.InitializeButton(2, "Slot3", "Slot 3", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 430, c);
     c = new OnClick(ButtonClickEvents.SaveMenuBackClick);
     this.InitializeButton(3, "Back", "Back", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 510, c);
     c = new OnClick(ButtonClickEvents.ToMainMenuClick);
     this.InitializeButton(4, "ExitToMainMenu", "Exit to Main Menu", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 590, c);
 }
Example #20
0
 public PauseMenuScreen()
 {
     this.buttons = new Button[5];
     OnClick c = new OnClick(ButtonClickEvents.ResumeGameClick);
     this.InitializeButton(0, "ResumeGame", "Resume Game", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 270, c);
     c = new OnClick(ButtonClickEvents.SaveGameClick);
     this.InitializeButton(1, "SaveGame", "Save Game", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 350, c);
     c = new OnClick(ButtonClickEvents.HelpClick);
     this.InitializeButton(2, "Help", "Help", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 430, c);
     c = new OnClick(ButtonClickEvents.ToMainMenuClick);
     this.InitializeButton(3, "ExitToMainMenu", "Exit to Main Menu", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 510, c);
     c = new OnClick(ButtonClickEvents.ExitClick);
     this.InitializeButton(4, "Quit", "Quit to Desktop", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 590, c);
 }
Example #21
0
 public MainMenuScreen()
 {
     this.buttons = new Button[5];
     OnClick c = new OnClick(ButtonClickEvents.NewGameClick);
     this.InitializeButton(0, "NewGame", "New Game", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 0, c);
     c = new OnClick(ButtonClickEvents.LoadGameClick);
     this.InitializeButton(1, "LoadGame", "Load Game", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 80, c);
     c = new OnClick(ButtonClickEvents.HighScoresClick);
     this.InitializeButton(2, "HighScores", "High Scores", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 160, c);
     c = new OnClick(ButtonClickEvents.HelpClick);
     this.InitializeButton(3, "Help", "Help", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 240, c);
     c = new OnClick(ButtonClickEvents.ExitClick);
     this.InitializeButton(4, "Exit", "Exit", 130, 53,
         (Screen.PrimaryScreen.Bounds.Width / 2 - 65), 320, c);
 }
Example #22
0
 private GContextMenu(object owner, PopupEntry[] list)
     : base(100, 100)
 {
     this.m_VertexPool = VertexConstructor.Create();
     this.m_Owner = owner;
     base.m_GUID = "MobilePopup";
     int num = 0;
     int num2 = 0;
     int length = list.Length;
     IFont uniFont = Engine.GetUniFont(3);
     IHue bright = Hues.Bright;
     IHue focusHue = Hues.Load(0x35);
     IHue hue = Hues.Default;
     OnClick onClick = new OnClick(this.Entry_OnClick);
     for (int i = 0; i < length; i++)
     {
         PopupEntry entry = list[i];
         GLabel toAdd = null;
         if (entry.Flags == 1)
         {
             toAdd = new GLabel(entry.Text, uniFont, hue, 7, 7 + num2);
         }
         else
         {
             toAdd = new GTextButton(entry.Text, uniFont, bright, focusHue, 7, 7 + num2, onClick);
             toAdd.SetTag("EntryID", entry.EntryID);
         }
         toAdd.X -= toAdd.Image.xMin;
         toAdd.Y -= toAdd.Image.yMin;
         num2 += (toAdd.Image.yMax - toAdd.Image.yMin) + 4;
         if (((toAdd.Image.xMax - toAdd.Image.xMin) + 1) > num)
         {
             num = (toAdd.Image.xMax - toAdd.Image.xMin) + 1;
         }
         base.m_Children.Add(toAdd);
     }
     num2 -= 3;
     this.m_Width = num + 14;
     this.m_Height = num2 + 14;
 }
 public AttitudeFragment(FlightComputer fc, OnClick queue)
 {
     mFlightComputer = fc;
     mOnClickQueue = queue;
 }
 private void Toast_Activated(ToastNotification sender, object args)
 {
     OnClick?.Invoke(this, new EventArgs());
 }
Example #25
0
    public void LoadData(CardType cardType, int value, int width, int height, Transform cardParent, Vector3 position, OnClick onClickDelegate)
    {
        OnClickDelegate = onClickDelegate;

        LoadData(cardType, value, width, height, cardParent, position);
    }
Example #26
0
 private void Awake()
 {
     button.onClick.AddListener(() => OnClick?.Invoke(this, new AssetButtonClickArgs(Item)));
 }
Example #27
0
        internal void DispatchEvent(Map map, MapJsEventArgs eventArgs)
        {
            switch (eventArgs.Type)
            {
            case "click":
                OnClick?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "contextmenu":
                OnContextMenu?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "dblclick":
                OnDblClick?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "layeradded":
                OnLayerAdded?.Invoke(new MapEventArgs(map, eventArgs.Type));
                break;

            case "layerremoved":
                OnLayerRemoved?.Invoke(new MapEventArgs(map, eventArgs.Type));
                break;

            case "mousedown":
                OnMouseDown?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseenter":
                OnMouseEnter?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseleave":
                OnMouseLeave?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mousemove":
                OnMouseMove?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseout":
                OnMouseOut?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseover":
                OnMouseOver?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseup":
                OnMouseUp?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "touchcancel":
                OnTouchCancel?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "touchend":
                OnTouchEnd?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "touchmove":
                OnTouchMove?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "touchstart":
                OnTouchStart?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "wheel":
                OnWheel?.Invoke(new MapEventArgs(map, eventArgs.Type));
                break;
            }
        }
Example #28
0
 protected async Task Clicked(UIMouseEventArgs e)
 {
     await OnClick.InvokeAsync(e);
 }
Example #29
0
 void Awake()
 {
     onClick = GetComponent <OnClick>();
 }
        static void Main(string[] args)
        {
            string code = "#include <tcclib.h>\n" +                        /* include the "Simple libc header for TCC" */
                          "#define _cdecl __attribute__((__cdecl__))\n" +  /*define cdelc calling convention*/
                          "#define _import __attribute__((dllimport))\n" + /*define dllimport for symbol*/
                          "_cdecl _import extern int add(int a, int b);\n" +
                          "_import extern const char hello[];\n" +
                          "_cdecl int fib(int n)\n" +
                          "{\n" +
                          "    if (n <= 2)\n" +
                          "        return 1;\n" +
                          "    else\n" +
                          "        return fib(n-1) + fib(n-2);\n" +
                          "}\n" +
                          "\n" +
                          "_cdecl int foo(int n, const char* txt)\n" +
                          "{\n" +
                          "    printf(\"%s\\n\", hello);\n" +
                          "    printf(\"fib(%d) = %d\\n\", n, fib(n));\n" +
                          "    printf(\"add(%d, %d) = %d\\n\", n, 2 * n, add(n, 2 * n));\n" +
                          "    printf(\"param Text=%s\\n\",txt);\n" +
                          "    return 0;\n" +
                          "}\n";


            //Create a Compiler Object please use always USING
            //The Object must be disposed!!!
            using (var compiler = new TccCompiler())
            {
                //compiler.SetOutPutType(TccOutputType.Memory);
                //string fp = Path.Combine(Environment.CurrentDirectory, "Code.c");

                //code = File.ReadAllText(fp);



                //if (compiler.CompileString(code) == -1)
                //{
                //    Console.WriteLine("Could not comple");
                //    return;
                //}


                DelegatePtr bnClick = new OnClick(OnButtonClick);
                compiler.BeforeCompileAction = () =>
                {
                    compiler.AddSymbol("ButtonClick", bnClick);
                };

                compiler.CompilerErrorAction = ErrorFuncDel;
                //Waits until windows closed!
                compiler.Run("Code.c");

                bnClick.Dispose();

                //Add addDel = AddImp;
                //DelegatePtr addPtr = addDel;
                //int retVal = compiler.AddSymbol("add", addPtr);
                //if (retVal != 0)
                //{
                //    Console.WriteLine("Cannot add Smbol add!");
                //    addPtr.Dispose();
                //    return;
                //}


                //string hello = "hallo Welt";
                ////IntPtr halloPtr = Marshal.StringToHGlobalAnsi(hello);
                //HGlobalAnsiStringPtr halloPtr = hello;
                //compiler.AddSymbol("hello", halloPtr);

                //if (compiler.Reallocate(TccRealocateConst.TCC_RELOCATE_AUTO) < 0)
                //{
                //    Console.WriteLine("Could not reloacate the intern pointers");
                //    addPtr.Dispose();
                //    halloPtr.Dispose();
                //    return;
                //}

                //DelegatePtr<Foo> fooPtr = compiler.GetSymbol("foo");
                //if (!fooPtr.IsValid)
                //{
                //    Console.WriteLine("cannot get foo Symbol!");
                //    addPtr.Dispose();
                //    halloPtr.Dispose();
                //    return;
                //}

                //fooPtr.Delegate(32, "Eingabe Text1");
                //fooPtr.Delegate(23, "Eingabe Text2");

                //halloPtr.Dispose();
                //addPtr.Dispose();
            }
        }
 public void SetOnFinished(OnClick click)
 {
     Debugger.Log("SetOnFinished OnClick");
 }
 public UIButtonActionTarget(OnClick action) => Value = action;
Example #33
0
 void ClickHandler(bool value)
 {
     OnClick.Dispatch(value);
     MoveToggle(value, true);
 }
Example #34
0
        /// <summary>
        /// Create the DropDown list.
        /// </summary>
        /// <param name="size">List size (refers to the whole size of the list + the header when dropdown list is opened).</param>
        /// <param name="anchor">Position anchor.</param>
        /// <param name="offset">Offset from anchor position.</param>
        /// <param name="skin">Panel skin to use for this DropDown list and header.</param>
        public DropDown(Vector2 size, Anchor anchor = Anchor.Auto, Vector2?offset = null, PanelSkin skin = PanelSkin.ListBackground) :
            base(size, anchor, offset)
        {
            // default padding of self is 0
            Padding = Vector2.Zero;

            // to get collision right when list is opened
            UseActualSizeForCollision = true;

            // create the panel and paragraph used to show currently selected value (what's shown when drop-down is closed)
            _selectedTextPanel     = new Panel(new Vector2(0, SelectedPanelHeight), skin, Anchor.TopLeft);
            _selectedTextParagraph = UserInterface.DefaultParagraph(string.Empty, Anchor.CenterLeft);
            _selectedTextParagraph.UseActualSizeForCollision = false;
            _selectedTextParagraph.UpdateStyle(SelectList.DefaultParagraphStyle);
            _selectedTextParagraph.UpdateStyle(DefaultParagraphStyle);
            _selectedTextParagraph.UpdateStyle(DefaultSelectedParagraphStyle);
            _selectedTextPanel.AddChild(_selectedTextParagraph, true);

            // create the arrow down icon
            _arrowDownImage = new Image(Resources.ArrowDown, new Vector2(ArrowSize, ArrowSize), ImageDrawMode.Stretch, Anchor.CenterRight, new Vector2(-10, 0));
            _selectedTextPanel.AddChild(_arrowDownImage, true);

            // create the list component
            _selectList = new SelectList(size, Anchor.TopCenter, Vector2.Zero, skin);

            // update list offset and space before
            _selectList.SetOffset(new Vector2(0, SelectedPanelHeight));
            _selectList.SpaceBefore = Vector2.Zero;

            // add the header and select list as children
            AddChild(_selectedTextPanel);
            AddChild(_selectList);

            // add callback on list value change
            _selectList.OnValueChange = (Entity entity) =>
            {
                // hide list
                ListVisible = false;

                // set selected text
                _selectedTextParagraph.Text = (SelectedValue ?? DefaultText);
            };

            // hide the list by default
            _selectList.Visible = false;

            // setup the callback to show / hide the list when clicking the dropbox
            _selectedTextPanel.OnClick = (Entity self) =>
            {
                // change visibility
                ListVisible = !ListVisible;
            };

            // set starting text
            _selectedTextParagraph.Text = (SelectedValue ?? DefaultText);

            // update styles
            _selectList.UpdateStyle(DefaultStyle);

            // make the list events trigger the dropdown events
            _selectList.OnListChange       += (Entity entity) => { OnListChange?.Invoke(this); };
            _selectList.OnMouseDown        += (Entity entity) => { OnMouseDown?.Invoke(this); };
            _selectList.OnMouseReleased    += (Entity entity) => { OnMouseReleased?.Invoke(this); };
            _selectList.WhileMouseDown     += (Entity entity) => { WhileMouseDown?.Invoke(this); };
            _selectList.WhileMouseHover    += (Entity entity) => { WhileMouseHover?.Invoke(this); };
            _selectList.OnClick            += (Entity entity) => { OnClick?.Invoke(this); };
            _selectList.OnValueChange      += (Entity entity) => { OnValueChange?.Invoke(this); };
            _selectList.OnMouseEnter       += (Entity entity) => { OnMouseEnter?.Invoke(this); };
            _selectList.OnMouseLeave       += (Entity entity) => { OnMouseLeave?.Invoke(this); };
            _selectList.OnMouseWheelScroll += (Entity entity) => { OnMouseWheelScroll?.Invoke(this); };
            _selectList.OnStartDrag        += (Entity entity) => { OnStartDrag?.Invoke(this); };
            _selectList.OnStopDrag         += (Entity entity) => { OnStopDrag?.Invoke(this); };
            _selectList.WhileDragging      += (Entity entity) => { WhileDragging?.Invoke(this); };
            _selectList.BeforeDraw         += (Entity entity) => { BeforeDraw?.Invoke(this); };
            _selectList.AfterDraw          += (Entity entity) => { AfterDraw?.Invoke(this); };
            _selectList.BeforeUpdate       += (Entity entity) => { BeforeUpdate?.Invoke(this); };
            _selectList.AfterUpdate        += (Entity entity) => { AfterUpdate?.Invoke(this); };

            // make the selected value panel trigger the dropdown events
            _selectedTextPanel.OnMouseDown        += (Entity entity) => { OnMouseDown?.Invoke(this); };
            _selectedTextPanel.OnMouseReleased    += (Entity entity) => { OnMouseReleased?.Invoke(this); };
            _selectedTextPanel.WhileMouseDown     += (Entity entity) => { WhileMouseDown?.Invoke(this); };
            _selectedTextPanel.WhileMouseHover    += (Entity entity) => { WhileMouseHover?.Invoke(this); };
            _selectedTextPanel.OnClick            += (Entity entity) => { OnClick?.Invoke(this); };
            _selectedTextPanel.OnValueChange      += (Entity entity) => { OnValueChange?.Invoke(this); };
            _selectedTextPanel.OnMouseEnter       += (Entity entity) => { OnMouseEnter?.Invoke(this); };
            _selectedTextPanel.OnMouseLeave       += (Entity entity) => { OnMouseLeave?.Invoke(this); };
            _selectedTextPanel.OnMouseWheelScroll += (Entity entity) => { OnMouseWheelScroll?.Invoke(this); };
            _selectedTextPanel.OnStartDrag        += (Entity entity) => { OnStartDrag?.Invoke(this); };
            _selectedTextPanel.OnStopDrag         += (Entity entity) => { OnStopDrag?.Invoke(this); };
            _selectedTextPanel.WhileDragging      += (Entity entity) => { WhileDragging?.Invoke(this); };
            _selectedTextPanel.BeforeDraw         += (Entity entity) => { BeforeDraw?.Invoke(this); };
            _selectedTextPanel.AfterDraw          += (Entity entity) => { AfterDraw?.Invoke(this); };
            _selectedTextPanel.BeforeUpdate       += (Entity entity) => { BeforeUpdate?.Invoke(this); };
            _selectedTextPanel.AfterUpdate        += (Entity entity) => { AfterUpdate?.Invoke(this); };
        }
Example #35
0
 public MenuItem(Texture2D texture, Rectangle rect, OnClick click, Vector2 target) : this(texture, rect, click)
 {
     _target = target;
 }
Example #36
0
 internal void InvokeOnClick()
 {
     OnClick?.Invoke();
 }
Example #37
0
 protected void OnDropdownClick(MouseEventArgs e)
 {
     OnClick.InvokeAsync(e);
     Toogle();
 }
Example #38
0
 public void AddListener(OnClick newClick)
 {
     myClick += newClick;
 }
Example #39
0
 public GButton(int GumpID, int X, int Y, OnClick ClickHandler)
     : this(GumpID, GumpID + 1, GumpID + 2, X, Y, ClickHandler)
 {
 }
Example #40
0
 public void DeleteListener(OnClick notNeeded)
 {
     myClick -= notNeeded;
 }
 public void SetOnFinished(OnClick click)
 {
     Debugger.Log("SetOnFinished OnClick");
 }
Example #42
0
 private static void OpenDyeWindow(OnClick OnClick, Gump g)
 {
     GAlphaBackground background = new GAlphaBackground(0, 0, 0xb8, 110) {
         m_NonRestrictivePicking = true,
         m_CanDrag = false,
         X = 0,
         Y = g.Parent.Height - 1
     };
     GHuePicker toAdd = new GHuePicker(4, 4) {
         Brightness = 1
     };
     toAdd.SetTag("Dialog", background);
     background.Children.Add(toAdd);
     background.Children.Add(new GSingleBorder(3, 3, 0xa2, 0x52));
     background.Children.Add(new GSingleBorder(0xa4, 3, 0x11, 0x52));
     GBrightnessBar bar = new GBrightnessBar(0xa5, 4, 15, 80, toAdd);
     background.Children.Add(bar);
     bar.Refresh();
     GFlatButton okay = new GFlatButton(0x7b, 0x57, 0x3a, 20, "Okay", OnClick);
     okay.SetTag("Hue Picker", toAdd);
     okay.SetTag("Dialog", background);
     okay.SetTag("Button", g);
     background.Children.Add(new GQuickHues(toAdd, bar, okay));
     background.Children.Add(okay);
     g.Parent.Children.Add(background);
 }
Example #43
0
 private void Awake()
 {
     retryButton.onClick.AddListener( ()=>OnClick?.Invoke());
     nextButton.onClick.AddListener( ()=>OnClick?.Invoke());
 }
Example #44
0
        protected async Task OnDropdownClick(MouseEventArgs e)
        {
            await OnClick.InvokeAsync(e);

            Toogle();
        }
Example #45
0
 public static void ShowCharCreationSkills(int Str, int Dex, int Int, int vSkill1, int vSkill2, int vSkill3, int iSkill1, int iSkill2, int iSkill3)
 {
     GButton button2;
     GVSlider slider;
     GTextButton button3;
     GTextButton button4;
     GTextButton button5;
     Cursor.Hourglass = false;
     GBackground toAdd = new GBackground(0xa2c, 0x222, 0x160, 80, 80, true);
     toAdd.Children.Add(new GImage(0x58b, 0x42, -22));
     toAdd.Children.Add(new GImage(0x589, 0x8e, -38));
     toAdd.Children.Add(new GImage(0x1580, 0x97, -30));
     toAdd.Children.Add(new GButton(0x119c, 120, 0x114, null));
     GListBox box = new GListBox(GetFont(9), Hues.Load(0x76b), Hues.Load(0x961), 0xbbc, 40, 0x39, 0xcc, 0xd6, true);
     Client.Skills skills = Skills;
     for (int i = 0; i < 0x100; i++)
     {
         Skill skill = skills[i];
         if (skill == null)
         {
             break;
         }
         box.AddItem(skill.Name);
     }
     box.OnClick = new OnClick(Engine.CharSkill_OnClick);
     toAdd.Children.Add(box);
     int num2 = 0x31 - box.ItemCount;
     if (num2 < 0)
     {
         num2 = 0;
     }
     GButton button = new GButton(250, 250, 0xfb, box.X + box.Width, box.Y, new OnClick(Engine.ScrollUp_OnClick));
     toAdd.Children.Add(button);
     button2 = new GButton(0xfc, 0xfc, 0xfd, box.X + box.Width, box.Y + box.Height, new OnClick(Engine.ScrollDown_OnClick)) {
         Y = button2.Y - button2.Height
     };
     toAdd.Children.Add(button2);
     toAdd.Children.Add(new GBackground(0x100, button.Width, button2.Y - (button.Y + button.Height), button.X, button.Y + button.Height, false));
     slider = new GVSlider(0xfe, (box.X + box.Width) + 1, button.Y + button.Height, 13, button2.Y - (button.Y + button.Height), 0.0, 0.0, (double) num2, 1.0) {
         Y = slider.Y + slider.HalfHeight,
         Height = slider.Height - (slider.HalfHeight * 2),
         OnValueChange = new OnValueChange(Engine.ListView_OnValueChange)
     };
     slider.SetTag("ListBox", box);
     slider.SetValue(0.0, false);
     toAdd.Children.Add(slider);
     button.SetTag("Scroller", slider);
     button2.SetTag("Scroller", slider);
     toAdd.Children.Add(new GBackground(0xbbc, 0x69, 0x19, 270, 0xba, true));
     toAdd.Children.Add(new GBackground(0xbbc, 0x69, 0x19, 270, 0xd8, true));
     toAdd.Children.Add(new GBackground(0xbbc, 0x69, 0x19, 270, 0xf6, true));
     toAdd.Children.Add(new GLabel("Strength", GetFont(1), Hues.Load(1), 280, 0x38));
     toAdd.Children.Add(new GLabel("Dexterity", GetFont(1), Hues.Load(1), 280, 0x56));
     toAdd.Children.Add(new GLabel("Intelligence", GetFont(1), Hues.Load(1), 280, 0x74));
     int[] numArray = new int[] { 0x39, 0x57, 0x75, 0xc1, 0xdf, 0xfd };
     int[] numArray2 = new int[] { Str, Dex, Int, vSkill1, vSkill2, vSkill3 };
     double[] numArray3 = new double[] { 10.0, 10.0, 10.0, 0.0, 0.0, 0.0 };
     double[] numArray4 = new double[] { 60.0, 60.0, 60.0, 50.0, 50.0, 50.0 };
     double[] numArray5 = new double[] { 80.0, 80.0, 80.0, 100.0, 100.0, 100.0 };
     GSlider[] sliderArray = new GSlider[6];
     GLabel[] labelArray = new GLabel[6];
     for (int j = 0; j < 6; j++)
     {
         toAdd.Children.Add(new GImage(0xd5, 420, numArray[j]));
         toAdd.Children.Add(new GBackground(0xd6, 0x4b, 14, 0x1b1, numArray[j], false));
         toAdd.Children.Add(new GImage(0xd7, 0x1fc, numArray[j]));
         GLabel label = new GLabel(numArray2[j].ToString(), GetFont(1), Hues.Load(1), 380, numArray[j] - 1);
         GSlider slider2 = new GSlider(0xd8, 0x1a8, numArray[j], 0x5d, 14, (double) numArray2[j], numArray3[j], numArray4[j], 1.0) {
             OnValueChange = new OnValueChange(Engine.UpdateStaticSlider_OnValueChange)
         };
         slider2.SetTag("Static", label);
         slider2.SetTag("Font", GetFont(1));
         slider2.SetTag("Hue", Hues.Load(1));
         slider2.SetTag("Max", numArray5[j]);
         sliderArray[j] = slider2;
         labelArray[j] = label;
         toAdd.Children.Add(label);
         toAdd.Children.Add(slider2);
     }
     for (int k = 0; k < 3; k++)
     {
         string name = string.Format("Slider{0}", k + 1);
         sliderArray[0].SetTag(name, sliderArray[k]);
         sliderArray[1].SetTag(name, sliderArray[k]);
         sliderArray[2].SetTag(name, sliderArray[k]);
         sliderArray[3].SetTag(name, sliderArray[k + 3]);
         sliderArray[4].SetTag(name, sliderArray[k + 3]);
         sliderArray[5].SetTag(name, sliderArray[k + 3]);
     }
     OnClick onClick = new OnClick(Engine.CharSkillBox_OnClick);
     button3 = new GTextButton((iSkill1 == -1) ? "Click Here" : Skills[iSkill1].Name, GetFont(9), Hues.Load(0x76b), Hues.Load(0x961), 0x113, 0xbf, onClick) {
         X = 0x112,
         Y = 0xd1 - button3.Height
     };
     button3.SetTag("List", box);
     button3.SetTag("Skill", iSkill1);
     toAdd.Children.Add(button3);
     button4 = new GTextButton((iSkill2 == -1) ? "Click Here" : Skills[iSkill2].Name, GetFont(9), Hues.Load(0x76b), Hues.Load(0x961), 0x113, 0xbf, onClick) {
         X = 0x112,
         Y = 0xef - button4.Height
     };
     button4.SetTag("List", box);
     button4.SetTag("Skill", iSkill2);
     toAdd.Children.Add(button4);
     button5 = new GTextButton((iSkill3 == -1) ? "Click Here" : Skills[iSkill3].Name, GetFont(9), Hues.Load(0x76b), Hues.Load(0x961), 0x113, 0xbf, onClick) {
         X = 0x112,
         Y = 0x10d - button5.Height
     };
     button5.SetTag("List", box);
     button5.SetTag("Skill", iSkill3);
     toAdd.Children.Add(button5);
     toAdd.Children.Add(new GHotspot(270, 0xba, 0x69, 0x19, button3));
     toAdd.Children.Add(new GHotspot(270, 0xd8, 0x69, 0x19, button4));
     toAdd.Children.Add(new GHotspot(270, 0xf6, 0x69, 0x19, button5));
     Gumps.Desktop.Children.Clear();
     Gumps.Desktop.Children.Add(new GBackground(0x588, ScreenWidth, ScreenHeight, false));
     Gumps.Desktop.Children.Add(new GImage(0x157c, 0, 0));
     Gumps.Desktop.Children.Add(new GImage(0x15a0, 0, 4));
     GButton button6 = new GButton(0x1589, 0x22b, 4, new OnClick(Engine.Quit_OnClick)) {
         Tooltip = new Tooltip(Strings.GetString("Tooltips.Quit"))
     };
     Gumps.Desktop.Children.Add(button6);
     GButton button7 = new GButton(0x15a4, 610, 0x1bd, new OnClick(Engine.CharCreationSkillsArrow_OnClick));
     button7.SetTag("Strength", labelArray[0]);
     button7.SetTag("Dexterity", labelArray[1]);
     button7.SetTag("Intelligence", labelArray[2]);
     button7.SetTag("vSkill1", labelArray[3]);
     button7.SetTag("vSkill2", labelArray[4]);
     button7.SetTag("vSkill3", labelArray[5]);
     button7.SetTag("iSkill1", button3);
     button7.SetTag("iSkill2", button4);
     button7.SetTag("iSkill3", button5);
     Gumps.Desktop.Children.Add(button7);
     Gumps.Desktop.Children.Add(toAdd);
 }
Example #46
0
 void OnButtonClickHandler()
 {
     OnClick?.Invoke(_id);
 }
Example #47
0
 public UIButton(string label, OnClick onClick)
 {
     OnActivate = onClick;
     _label = label;
     Size = FontManager.Instance.BangersLarge.MeasureString(_label);
 }
Example #48
0
 /// <inheritdoc />
 public override void Dispose()
 {
     OnClick.RemoveAllListeners();
     base.Dispose();
 }
 public RoverFragment(FlightComputer fc, OnClick queue)
 {
     mFlightComputer = fc;
     mOnClickQueue = queue;
 }
 public StateButton(Vector2 location, string upTexture, string hoverTexture, string downTexture)
     : base(location, upTexture, hoverTexture, downTexture)
 {
     Click += new OnClick(StateButton_Click);
     States.Add(new ButtonState(upTexture, hoverTexture, downTexture));
 }
Example #51
0
 private void Start()
 {
     _btnParam.onClick.AddListener(() => { OnClick?.Invoke(_paramName, _paramId, _type); });
 }
Example #52
0
 public void Click()
 {
     OnClick.Dispatch();
 }
Example #53
0
        /// <summary>
        /// BuildRenderTree 方法
        /// </summary>
        /// <param name="builder"></param>
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            if (Collapse != null)
            {
                foreach (var item in Collapse.Items)
                {
                    var index = 0;
                    builder.OpenElement(index++, "div");
                    builder.AddAttribute(index++, "class", "card");

                    builder.OpenElement(index++, "div");
                    builder.AddAttribute(index++, "class", "card-header");

                    builder.OpenElement(index++, "div");
                    builder.AddAttribute(index++, "class", "card-header-wrapper");

                    builder.OpenElement(index++, "button");
                    builder.AddAttribute(index, "class", GetButtonClassString(item.IsCollapsed));
                    builder.AddAttribute(index, "type", "button");
                    builder.AddAttribute(index, "data-toggle", "collapse");
                    builder.AddAttribute(index, "aria-expanded", item.IsCollapsed ? "false" : "true");
                    builder.AddContent(index++, item.Text);
                    builder.CloseElement(); // end button

                    if (Collapse.ShowArrow)
                    {
                        builder.OpenElement(index++, "i");
                        builder.AddAttribute(index++, "class", "fa fa-angle-down");
                        builder.CloseElement();
                    }
                    builder.CloseElement(); // end div

                    builder.CloseElement(); // end div

                    builder.OpenElement(index++, "div");
                    builder.AddAttribute(index++, "class", GetClassString(item.IsCollapsed));
                    builder.AddAttribute(index++, "onclick", EventCallback.Factory.Create(this, () => OnClick?.Invoke(item)));

                    builder.OpenElement(index++, "div");
                    builder.AddAttribute(index++, "class", "card-body");
                    builder.AddContent(index++, item.ChildContent);

                    builder.CloseElement(); // end body

                    builder.CloseElement(); // end div
                    builder.CloseElement(); // end card
                }
            }
        }
Example #54
0
 public void Click()
 {
     OnClick?.Invoke();
 }
 public void Click(ClickableInputEventArgs args)
 {
     OnClick?.Invoke(args);
 }
Example #56
0
 private void Item_OnClick(object sender, EventArgs e)
 {
     OnClick?.Invoke(sender, e);
 }
Example #57
0
 public MenuItem(Texture2D texture, Rectangle rect, OnClick click) : this(rect, click)
 {
     _texture = texture;
 }
Example #58
0
 public void NotifyClick(MouseEvent eventArgs) => OnClick?.Invoke(this, eventArgs);
Example #59
0
 private void CallClick()
 {
     OnClick?.Invoke();
 }
Example #60
0
 private void NotifyDataChanged() => OnClick?.Invoke();