Exemple #1
0
        public void AddIndex(int X)
        {
            int prevIndex = selectedWidgetIndex;

            selectedWidgetIndex += X;
            while (selectedWidgetIndex < 0)
            {
                selectedWidgetIndex += childrenCount;
            }
            while (selectedWidgetIndex >= childrenCount)
            {
                selectedWidgetIndex -= childrenCount;
            }
            MWidget was = Children[prevIndex];
            MWidget now = Children[selectedWidgetIndex];

            was.Controller.SendEvent(MEvent.LockEvent(this));
            now.Controller.SendEvent(MEvent.UnlockEvent(this));

            if (was as MLayout != null || now as MLayout != null)
            {
                Redraw();
            }
            else
            {
                RedrawChild(now); RedrawChild(was);
            }
            Logs.Trace(String.Format("{0}: selected {1}->{2}", name, prevIndex, selectedWidgetIndex));
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.BackgroundColor = ConsoleColor.DarkBlue;
            Console.Clear();
            Logs.Write = true;
            MDrawHandler.MaximiseWindow();

            MWidget testV = TestForm();

            testV.Controller.SendEvent(MEvent.RedrawEvent(new MPoint(4, 10), testV));
            testV.Controller.SendEvent(MEvent.UnlockEvent(testV));
            testV.Redraw();
            while (true)
            {
                testV.Controller.SendEvent(MEvent.ButtonPressEvent(Console.ReadKey(true), testV));
            }

            //Player p1 = new Player("Lev");
            //Player p2 = new Player("Kotenka");
            //p1.Opponents.Add(p2);
            //p2.Opponents.Add(p1);
            //PlayerHandler.DrawPlayer(new MPoint(2, 2), p1, 40);

            Console.ReadLine();
        }
Exemple #3
0
 protected void ExecuteEvent(MEvent E)
 {
     Logs.TraceMarked(String.Format("{0} executes {1}from {2}", Widget.name, E.ToString(), E.Sender.name), new List <String>()
     {
         Widget.name, E.ToString(), E.Sender.name
     });
     actions[(int)E.Type](E.Params, Widget, E.Sender);
 }
Exemple #4
0
 private void ExecuteForAllUnlockedChildren(MEvent E)
 {
     foreach (MWidget w in Widget.Children)
     {
         if (w.Controller != null && !w.IsLocked)
         {
             w.Controller.SendEvent(E);
         }
     }
 }
Exemple #5
0
 private void ExecuteForAllChildren(MEvent E)
 {
     foreach (MWidget w in Widget.Children)
     {
         if (w.Controller != null)
         {
             w.Controller.SendEvent(E);
         }
     }
 }
Exemple #6
0
 public void SendEvent(MEvent E)
 {
     ExecuteEvent(E);
 }