示例#1
0
 public StateSymbolDirectionTriple(
     uint state,
     int symbol,
     TMDirection direction,
     long shift = 1)
 {
     this.State     = state;
     this.Symbol    = symbol;
     this.Direction = direction;
     this.Shift     = shift;
 }
示例#2
0
 public void MoveHead(TMDirection dir)
 {
     Stack<Character> l = LStack, r = RStack;
     switch (dir) {
         case TMDirection.Left:
             Stack<Character> t = l;
             l = r;
             r = t;
             goto case TMDirection.Right;
         case TMDirection.Right:
             l.Push (r.Pop ());
             this.Fix ();
             break;
     }
 }
示例#3
0
        public void MoveHead(TMDirection dir)
        {
            Stack <Character> l = LStack, r = RStack;

            switch (dir)
            {
            case TMDirection.Left:
                Stack <Character> t = l;
                l = r;
                r = t;
                goto case TMDirection.Right;

            case TMDirection.Right:
                l.Push(r.Pop());
                this.Fix();
                break;
            }
        }
示例#4
0
 public TMEdge(State <TMEdge> state, Character chr, TMDirection dir) : base(state, chr, dir)
 {
 }
示例#5
0
 /// <summary>
 /// 启动特效
 /// </summary>
 public void MStart(TMDirection dirction, int interval = 0)
 {
     MDirection = dirction;
     MStart(interval);
 }
示例#6
0
 /// <summary>
 /// 切换界面控件
 /// </summary>
 public static MControl ReLoad(Control parent, Type type, TMDirection direction)
 {
     return(ReLoad(parent, type, EventArgs.Empty, direction));
 }
示例#7
0
        /// <summary>
        /// 切换界面控件
        /// 如已加载,则调用ReLoad()
        /// </summary>
        public static MControl ReLoad(Control parent, Type type, EventArgs e, TMDirection direction, int intervel = -1)
        {
            var      first   = false;
            MControl control = null;

            try
            {
                //不重复加载
                if (Current != null)
                {
                    if (Current.GetType() == type && Current.Parent == parent)
                    {
                        return(Current);
                    }
                }
                //加载控件
                if (List.ContainsKey(type))
                {
                    if (List[type].ILoad)
                    {
                        return(control = List[type]);
                    }
                }
                //移除旧控件
                var temp = parent;
                if (parent.Controls.Count == 1)
                {
                    if (parent.Controls[0] is MControl)
                    {
                        temp = parent.Controls[0];
                        //拒绝移除
                        if (!(temp as MControl).UnLoad())
                        {
                            return(null);
                        }
                    }
                }

                //加载控件
                if (List.ContainsKey(type))
                {
                    control = List[type];
                }
                parent.SuspendLayout();
                //加载控件
                if (control == null)
                {
                    first   = true;
                    control = (MControl)Activator.CreateInstance(type);
                }
                if (control == null)
                {
                    throw new ArgumentException($"{type.FullName} Not a valid MControl.");
                }
                if (e != null)
                {
                    control.Args = e;
                }
                if (direction == TMDirection.None)
                {
                    direction = control.MDirection;
                }

                //特效显示
                switch (direction)
                {
                case TMDirection.Transparent:
                case TMDirection.T3DLeft:
                case TMDirection.T3DLeftToRight:
                case TMDirection.T3DRight:
                case TMDirection.T3DRightToLeft:
                case TMDirection.T3DUp:
                case TMDirection.T3DUpToDown:
                case TMDirection.T3DDown:
                case TMDirection.T3DDownToUp:
                    if (temp.Width > 0 && temp.Height > 0)
                    {
                        var bitmap = new Bitmap(temp.Width, temp.Height);
                        temp.DrawToBitmap(bitmap, new Rectangle(0, 0, temp.Width, temp.Height));
                        control.TranImage            = bitmap;
                        parent.BackgroundImageLayout = ImageLayout.Stretch;
                        parent.BackgroundImage       = control.TranImage;
                    }
                    break;
                }
                parent.Controls.Clear();

                //加载新控件属性
                control.MDirection = TMDirection.None;
                if (intervel != -1)
                {
                    control.MInterval = intervel;
                }
                control.Dock = DockStyle.Fill;
                parent.Controls.Add(control);
                control.MDirection = direction;
                control.MChild();
                if (!List.ContainsKey(type))
                {
                    List.Add(type, control);
                }
                parent.BackgroundImage = null;
                parent.ResumeLayout();

                return(control);
            }
            finally
            {
                if (control != null)
                {
                    Current = control;
                }
                if (e != null)
                {
                    Current.Args = e;
                }
                Current.Focus();
                Current.ReLoad(first);
            }
        }
示例#8
0
 public TuringVal(uint qNext, char c, TMDirection dir)
 {
     this.qNext     = qNext;
     this.c2        = c;
     this.Direction = dir;
 }
示例#9
0
 public void AddByStateStoreAndBand(string[] states, string[] band, char[] bandTrans, string q, string c, string qNext, string c2, TMDirection dir)
 {
     base.Add(
         new TuringKey(states.ArrayIndex(q), bandTrans[band.ArrayIndex(c)]),
         new TuringVal(states.ArrayIndex(qNext), bandTrans[band.ArrayIndex(c2)], dir)
         );
 }
示例#10
0
 public void AddByStateStore(string[] states, string q, char c, string qNext, char c2, TMDirection dir)
 {
     base.Add(new TuringKey(states.ArrayIndex(q), c), new TuringVal(states.ArrayIndex(qNext), c2, dir));
 }
示例#11
0
 public void Add(uint q, char c, uint qNext, char c2, TMDirection dir)
 {
     Add(new TuringKey(q, c), new TuringVal(qNext, c2, dir));
 }
示例#12
0
 public void AddByStateStoreAndTracks(string q, string c1, string qNext, string c2, TMDirection dir)
 {
     Add(new TuringTransformMultiTrack.TuringKey(StateTracks.ArrayIndex(q),
                                                 c1.Replace(",", string.Empty).ToCharArray().Reverse().ToArray()),
         new TuringTransformMultiTrack.TuringVal(StateTracks.ArrayIndex(qNext),
                                                 c2.Replace(",", string.Empty).ToCharArray().Reverse().ToArray(), dir));
 }