예제 #1
0
        public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext, bool readOnly)
            : base(readOnly ? 310 : 50, 50)
        {
            this.m_From = from;
            this.m_Ruleset = ruleset;
            this.m_Page = page;
            this.m_DuelContext = duelContext;
            this.m_ReadOnly = readOnly;

            this.Dragable = !readOnly;

            from.CloseGump(typeof(RulesetGump));
            from.CloseGump(typeof(DuelContextGump));
            from.CloseGump(typeof(ParticipantGump));

            RulesetLayout depthCounter = page;
            int depth = 0;

            while (depthCounter != null)
            {
                ++depth;
                depthCounter = depthCounter.Parent;
            }

            int count = page.Children.Length + page.Options.Length;

            this.AddPage(0);

            int height = 35 + 10 + 2 + (count * 22) + 2 + 30;

            this.AddBackground(0, 0, 260, height, 9250);
            this.AddBackground(10, 10, 240, height - 20, 0xDAC);

            this.AddHtml(35, 25, 190, 20, this.Center(page.Title), false, false);

            int x = 35;
            int y = 47;

            for (int i = 0; i < page.Children.Length; ++i)
            {
                this.AddGoldenButton(x, y, 1 + i);
                this.AddHtml(x + 25, y, 250, 22, page.Children[i].Title, false, false);

                y += 22;
            }

            for (int i = 0; i < page.Options.Length; ++i)
            {
                bool enabled = ruleset.Options[page.Offset + i];

                if (readOnly)
                    this.AddImage(x, y, enabled ? 0xD3 : 0xD2);
                else
                    this.AddCheck(x, y, 0xD2, 0xD3, enabled, i);

                this.AddHtml(x + 25, y, 250, 22, page.Options[i], false, false);

                y += 22;
            }
        }
예제 #2
0
        public RulesetLayout FindByOption(string title, string option, ref int index)
        {
            if (title == null || m_Title == title)
            {
                index = GetOptionIndex(option);

                if (index >= 0)
                {
                    return(this);
                }

                title = null;
            }

            foreach (RulesetLayout l in m_Children)
            {
                RulesetLayout layout = l.FindByOption(title, option, ref index);

                if (layout != null)
                {
                    return(layout);
                }
            }

            return(null);
        }
예제 #3
0
        public RulesetLayout FindByOption(string title, string option, ref int index)
        {
            if (title == null || m_Title == title)
            {
                index = GetOptionIndex(option);

                if (index >= 0)
                {
                    return(this);
                }

                title = null;
            }

            for (int i = 0; i < m_Children.Length; ++i)
            {
                RulesetLayout layout = m_Children[i].FindByOption(title, option, ref index);

                if (layout != null)
                {
                    return(layout);
                }
            }

            return(null);
        }
예제 #4
0
        public RulesetLayout( string title, string description, RulesetLayout[] children, string[] options )
        {
            m_Title = title;
            m_Description = description;
            m_Children = children;
            m_Options = options;

            for ( int i = 0; i < children.Length; ++i )
                children[i].m_Parent = this;
        }
예제 #5
0
        public bool GetOption(string title, string option)
        {
            int           index  = 0;
            RulesetLayout layout = Layout.FindByOption(title, option, ref index);

            if (layout == null)
            {
                return(true);
            }

            return(Options[layout.Offset + index]);
        }
예제 #6
0
        public void SetOption(string title, string option, bool value)
        {
            int           index  = 0;
            RulesetLayout layout = Layout.FindByOption(title, option, ref index);

            if (layout == null)
            {
                return;
            }

            Options[layout.Offset + index] = value;

            Changed = true;
        }
예제 #7
0
        public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew)
        {
            this.m_Initiator = initiator;
            this.m_Participants = new ArrayList();
            this.m_Ruleset = new Ruleset(layout);
            this.m_Ruleset.ApplyDefault(layout.Defaults[0]);

            if (addNew)
            {
                this.m_Participants.Add(new Participant(this, 1));
                this.m_Participants.Add(new Participant(this, 1));

                ((Participant)this.m_Participants[0]).Add(initiator);
            }
        }
예제 #8
0
        public void SetOptionRange(string title, bool value)
        {
            RulesetLayout layout = Layout.FindByTitle(title);

            if (layout == null)
            {
                return;
            }

            for (int i = 0; i < layout.TotalLength; ++i)
            {
                Options[i + layout.Offset] = value;
            }

            Changed = true;
        }
예제 #9
0
        public RulesetLayout FindByTitle(string title)
        {
            if (m_Title == title)
            {
                return(this);
            }

            for (int i = 0; i < m_Children.Length; ++i)
            {
                RulesetLayout layout = m_Children[i].FindByTitle(title);

                if (layout != null)
                {
                    return(layout);
                }
            }

            return(null);
        }
예제 #10
0
 public Ruleset(RulesetLayout layout)
 {
     Layout  = layout;
     Options = new BitArray(layout.TotalLength);
 }
예제 #11
0
        public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext, bool readOnly = false)
            : base(readOnly ? 310 : 50, 50)
        {
            m_From        = from;
            m_Ruleset     = ruleset;
            m_Page        = page;
            m_DuelContext = duelContext;
            m_ReadOnly    = readOnly;

            Draggable = !readOnly;

            from.CloseGump <RulesetGump>();
            from.CloseGump <DuelContextGump>();
            from.CloseGump <ParticipantGump>();

            var depthCounter = page;

            while (depthCounter != null)
            {
                depthCounter = depthCounter.Parent;
            }

            var count = page.Children.Length + page.Options.Length;

            AddPage(0);

            var height = 35 + 10 + 2 + count * 22 + 2 + 30;

            AddBackground(0, 0, 260, height, 9250);
            AddBackground(10, 10, 240, height - 20, 0xDAC);

            AddHtml(35, 25, 190, 20, Center(page.Title));

            var x = 35;
            var y = 47;

            for (var i = 0; i < page.Children.Length; ++i)
            {
                AddGoldenButton(x, y, 1 + i);
                AddHtml(x + 25, y, 250, 22, page.Children[i].Title);

                y += 22;
            }

            for (var i = 0; i < page.Options.Length; ++i)
            {
                var enabled = ruleset.Options[page.Offset + i];

                if (readOnly)
                {
                    AddImage(x, y, enabled ? 0xD3 : 0xD2);
                }
                else
                {
                    AddCheck(x, y, 0xD2, 0xD3, enabled, i);
                }

                AddHtml(x + 25, y, 250, 22, page.Options[i]);

                y += 22;
            }
        }
예제 #12
0
		public DuelContext( Mobile initiator, RulesetLayout layout ) : this( initiator, layout, true )
		{
		}
예제 #13
0
 public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext)
     : this(from, ruleset, page, duelContext, false)
 {
 }
예제 #14
0
        public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext, bool readOnly)
            : base(readOnly ? 310 : 50, 50)
        {
            this.m_From        = from;
            this.m_Ruleset     = ruleset;
            this.m_Page        = page;
            this.m_DuelContext = duelContext;
            this.m_ReadOnly    = readOnly;

            this.Dragable = !readOnly;

            from.CloseGump(typeof(RulesetGump));
            from.CloseGump(typeof(DuelContextGump));
            from.CloseGump(typeof(ParticipantGump));

            RulesetLayout depthCounter = page;
            int           depth        = 0;

            while (depthCounter != null)
            {
                ++depth;
                depthCounter = depthCounter.Parent;
            }

            int count = page.Children.Length + page.Options.Length;

            this.AddPage(0);

            int height = 35 + 10 + 2 + (count * 22) + 2 + 30;

            this.AddBackground(0, 0, 260, height, 9250);
            this.AddBackground(10, 10, 240, height - 20, 0xDAC);

            this.AddHtml(35, 25, 190, 20, this.Center(page.Title), false, false);

            int x = 35;
            int y = 47;

            for (int i = 0; i < page.Children.Length; ++i)
            {
                this.AddGoldenButton(x, y, 1 + i);
                this.AddHtml(x + 25, y, 250, 22, page.Children[i].Title, false, false);

                y += 22;
            }

            for (int i = 0; i < page.Options.Length; ++i)
            {
                bool enabled = ruleset.Options[page.Offset + i];

                if (readOnly)
                {
                    this.AddImage(x, y, enabled ? 0xD3 : 0xD2);
                }
                else
                {
                    this.AddCheck(x, y, 0xD2, 0xD3, enabled, i);
                }

                this.AddHtml(x + 25, y, 250, 22, page.Options[i], false, false);

                y += 22;
            }
        }
예제 #15
0
		public DuelContext( Mobile initiator, RulesetLayout layout, bool addNew )
		{
			m_Initiator = initiator;
			m_Participants = new List<Participant>();
			m_Ruleset = new Ruleset( layout );
			m_Ruleset.ApplyDefault( layout.Defaults[0] );

			if ( addNew )
			{
				m_Participants.Add( new Participant( this, 1 ) );
				m_Participants.Add( new Participant( this, 1 ) );

				m_Participants[0].Add( initiator );
			}
		}
예제 #16
0
 public RulesetLayout( string title, RulesetLayout[] children, string[] options )
     : this(title, title, children, options)
 {
 }
예제 #17
0
 public RulesetLayout( string title, string description, RulesetLayout[] children )
     : this(title, description, children, new string[0])
 {
 }
예제 #18
0
 public RulesetLayout( string title, RulesetLayout[] children )
     : this(title, title, children, new string[0])
 {
 }
예제 #19
0
 public Ruleset(RulesetLayout layout)
 {
     this.m_Layout  = layout;
     this.m_Options = new BitArray(layout.TotalLength);
 }
예제 #20
0
파일: Ruleset.cs 프로젝트: FreeReign/forkuo
 public Ruleset(RulesetLayout layout)
 {
     this.m_Layout = layout;
     this.m_Options = new BitArray(layout.TotalLength);
 }
예제 #21
0
 public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext)
     : this(from, ruleset, page, duelContext, false)
 {
 }
예제 #22
0
		public RulesetLayout(string title, string description, RulesetLayout[] children, string[] options)
		{
			m_Title = title;
			m_Description = description;
			m_Children = children;
			m_Options = options;

			foreach (RulesetLayout l in children)
			{
				l.m_Parent = this;
			}
		}