Exemple #1
0
        protected void handle_click_event(Rect container, ClickEvents click_event)
        {
            if (container.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseDown)
            {
                ClickEvent evt = new ClickEvent();
                evt.contianer = container;
                if (Event.current.button == 0)
                {
                    double elapsed_seconds = (DateTime.Now - click_tracker).TotalSeconds;
                    click_tracker = DateTime.Now;

                    if (elapsed_seconds < 0.5 && last_click_target == container)
                    {
                        evt.double_click = true;
                    }
                    else
                    {
                        evt.single_click = true;
                    }
                }
                else if (Event.current.button == 1)
                {
                    evt.right_click = true;
                }
                last_click_target = container;
                click_event(evt);
                Event.current.Use();
            }
        }
Exemple #2
0
 void Start()
 {
     layerMask     = ~layerMask;
     clickEvents   = GetComponent <ClickEvents>();
     m_Raycaster   = GetComponent <GraphicRaycaster>();
     m_EventSystem = GetComponent <EventSystem>();
     audioSettings = FindObjectOfType <AudioSettings>();
 }
Exemple #3
0
        protected void v_section(float section_width, Content content, ClickEvents click_event)
        {
            GUILayout.BeginVertical(get_section_style(), GUILayout.Width(section_width), GUILayout.MaxWidth(section_width));
            content(section_width);
            GUILayout.EndVertical();
            Rect container = GUILayoutUtility.GetLastRect();

            handle_click_event(container, click_event);
        }
Exemple #4
0
        protected void section(float section_width, GUIStyle style, Content content, ClickEvents click_event)
        {
            GUILayout.BeginHorizontal(style, GUILayout.Width(section_width), GUILayout.MaxWidth(section_width));
            content(section_width);
            GUILayout.EndHorizontal();
            Rect container = GUILayoutUtility.GetLastRect();

            handle_click_event(container, click_event);
        }
Exemple #5
0
        protected Rect section(GUIStyle style, ContentNoArgs content, ClickEvents click_event)
        {
            GUILayout.BeginHorizontal(style);
            content();
            GUILayout.EndHorizontal();
            Rect container = GUILayoutUtility.GetLastRect();

            handle_click_event(container, click_event);
            return(container);
        }
 private void MenuOpenMcpack_Click(object sender, EventArgs e)
 {
     try
     {
         ClickEvents.OpenMcPackFile(this);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void MenuInstalledSkinPacks_Click(object sender, EventArgs e)
 {
     try
     {
         ClickEvents.OpenInstalledSkinFolder();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public StatInfo(StatInfo info)
        {
            this._Filter            = info.Filter.Copy();
            this._DenominatorFilter = info.DenominatorFilter.Copy();
            this._StatTypes         = info.StatTypes.Copy();
            this._ClickEvent        = info.ClickEvent;
            this._FieldName         = info.StatField;
            this._Title             = info.Title;
            this._Result            = new ArrayList();

            this._FollowedStatTypes = info._FollowedStatTypes.Copy();
        }
        //End

        public StatInfo()
        {
            this._Filter            = new DBFilter();
            this._DenominatorFilter = new DBFilter();
            this._StatTypes         = new StatTypesCollection();
            this._StatTypes.Add(Data.StatTypes.Frequence);
            this._ClickEvent = ClickEvents.PlayVideo;
            this._FieldName  = string.Empty;
            this._Result     = new ArrayList();
            this._Title      = "New Stat";

            this._FollowedStatTypes = new FollowedStatTypesCollection(this._StatTypes);   //Added this code at 2009-1-4 11:26:59@Simon
        }
 private void ButtonBrowseSkin_Click(object sender, EventArgs e)
 {
     try
     {
         if (Global.Skins.SkinList.Count > 0)
         {
             ClickEvents.OpenTextureFile(this);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void buttonImportMultiple_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsMcpackCreated(sender, e))
                {
                    return;
                }

                ClickEvents.OpenMultipleTextureFiles(this);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void ButtonRemove_Click(object sender, EventArgs e)
        {
            try
            {
                if (Global.Skins.SkinList.Count <= 0)
                {
                    return;
                }

                ClickEvents.RemoveSkin(this);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void ButtonAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (!IsMcpackCreated(sender, e))
                {
                    return;
                }

                ClickEvents.AddNewSkin(this);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void MenuSave_Click(object sender, EventArgs e)
        {
            try
            {
                var result = ClickEvents.SaveMcpack(this);
                if (Global.InstallFile && result)
                {
                    Process.Start(Global.McpackFilePath);
                }

                Global.InstallFile = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #15
0
        public void UpdateGame(object state)
        {
            if (updateRunning)
            {
                return;
            }

            updateRunning = true;
            Point clickedAt;

            if (ClickEvents.Any())
            {
                clickedAt = ClickEvents.Dequeue();
                var selectableGuys = Actors.OfType <SelectableGuy>();
                selectableGuys.Select(sg => sg.Selected = false);
                var selectedGuy = selectableGuys.FirstOrDefault(sg => sg.ContainsPoint(clickedAt));

                if (selectedGuy != null)
                {
                    var guy = selectedGuy as SelectableGuy;
                    guy.Selected = true;
                    var power = 1.5f;

                    var center = guy.CenterOfGuy;
                    var Direc  = new System.Numerics.Vector2((float)(center.X - clickedAt.X), (float)(center.Y - clickedAt.Y));
                    guy.XSpeed = Direc.X * power;
                    guy.YSpeed = Direc.Y * power;
                }
            }

            foreach (var actor in Actors)
            {
                actor.UpdateActor(Gamefield);
            }

            TestCollisions((act1, act2) => act1.Geometry.CompareWith(act2.Geometry) == CanvasGeometryRelation.Overlap);

            foreach (var actor in Actors)
            {
                actor.ResolveCollisions();
            }
            updateRunning = false;
        }
Exemple #16
0
    public void AddEvents(int i)
    {
        Button      button = GetButton(i - 1).GetComponent <Button>();
        ClickEvents c      = gameObject.GetComponent <ClickEvents>();

        switch (i)
        {
        case 1:
            button.onClick.AddListener(c.GotoLevel1);
            break;

        case 2:
            button.onClick.AddListener(c.GotoLevel2);
            break;

        case 3:
            button.onClick.AddListener(c.GotoLevel3);
            break;
        }

        Helper.SetTransparent(GetButton(i - 1).GetComponent <Image>(), 1f);
    }
        /// <summary>
        /// Konstruktor für eine InfoBox mit Titel, Info, einem Pfad zu einer Bilddatei sowie Möglichkeit ein Clickevent zu übergeben.
        /// </summary>
        /// <param name="titel">Titel</param>
        /// <param name="info">Infotext</param>
        /// <param name="picPath">Pfad zur Bilddatei</param>
        /// <param name="ac">Methode die ausgeführt werden soll</param>
        /// <param name="evclick">Control das Methode ausführen soll.</param>
        public frmInfoBox(string titel, string info, string picPath, Action ac, ClickEvents evclick)
        {
            InitializeComponent();

            Bitmap pic;

            try
            {
                pic = new Bitmap(picPath);
            }
            catch { pic = null; }

            setSettings(titel, info, pic);


            switch (evclick)
            {
            case ClickEvents.Info: { actionInfo = ac; rtbInfoText.Cursor = Cursors.Hand; break; }

            case ClickEvents.Pic: { actionPic = ac; pictureBox1.Cursor = Cursors.Hand; break; }

            case ClickEvents.Titel: { actionTitel = ac; lbTitel.Cursor = Cursors.Hand; break; }
            }
        }
        public StatInfo(SerializationInfo info, StreamingContext context)
        {
            try
            {
                this._ClickEvent = (ClickEvents)(info.GetValue("_ClickEvent", typeof(ClickEvents)));
            }
            catch
            {
                this._ClickEvent = ClickEvents.PlayVideo;
            }

            try
            {
                this._Title = info.GetString("_Title");
            }
            catch
            {
                this._Title = "New Stat";
            }

            try
            {
                this._FieldName = info.GetString("_FieldName");
            }
            catch
            {
                this._FieldName = string.Empty;
            }

            try
            {
                this._StatTypes = info.GetValue("_StatTypes", typeof(StatTypesCollection)) as StatTypesCollection;
            }
            catch
            {
                this._StatTypes = new StatTypesCollection();
            }

            try
            {
                this._Filter = info.GetValue("_Filter", typeof(DBFilter)) as DBFilter;

                this._Filter = AdvFilterConvertor.GetAdvFilter(DataProvider.VideoPlayBackManager.AdvReportFilters, this._Filter);    //2009-4-29 11:37:37@Simon Add UpdateAdvFilter
            }
            catch
            {
                this._Filter = new DBFilter();
            }

            try
            {
                this._DenominatorFilter = info.GetValue("_DenominatorFilter", typeof(DBFilter)) as DBFilter;

                this._DenominatorFilter = AdvFilterConvertor.GetAdvFilter(DataProvider.VideoPlayBackManager.AdvReportFilters, this._DenominatorFilter);    //2009-4-29 11:37:37@Simon Add UpdateAdvFilter
            }
            catch
            {
                this._DenominatorFilter = new DBFilter();
            }
            try  //Added this code at 2009-1-5 8:21:00@Simon
            {
                this._FollowedStatTypes = info.GetValue("_FollowedStatTypes", typeof(FollowedStatTypesCollection)) as FollowedStatTypesCollection;
            }
            catch
            {
                this._FollowedStatTypes = new FollowedStatTypesCollection(this._StatTypes);
            }
        }