示例#1
0
文件: Ship.cs 项目: scastle/Solitude
 /// <summary>
 /// Creates a wall based on information from an ObjectListItem o
 /// </summary>
 /// <param name="o">the information on the wall</param>
 private void ItemIsWall(ObjectListItem o)
 {
     WallType t;
                 Direction d = Direction.Left;
                 if (o.dimensions.X != 32) // Up or down
                 {
                     utilVector.X = o.dimensions.Y;
                     utilVector.Y = o.dimensions.X;
                     o.dimensions = utilVector;
                     d = Direction.Up;
                 }
                 string[] s = o.moreInfo.ToArray();
                 switch(s[0]){
                     case "HandHold":
                         t = WallType.HandHold; break;
                     case "Grip":
                         t = WallType.Grip; break;
                     case "Smooth":
                         t = WallType.Smooth; break;
                     case "Metal":
                         t = WallType.Metal; break;
                     case "Fire":
                         t = WallType.Hot; break;
                     case "Cold":
                         t = WallType.Cold; break;
                     case "Spike":
                         t = WallType.Spike; break;
                     default:    t = WallType.Smooth; break;
                 }
                 Wall w = new Wall(o.position, PhysicalWorld, o.dimensions.X, o.dimensions.Y, 1, t, d);
                 contents.Add(w);
 }
示例#2
0
文件: Ship.cs 项目: scastle/Solitude
 private void ItemIsMauler(ObjectListItem o)
 {
     SolitudeObjects.Enemies.Mauler m = new SolitudeObjects.Enemies.Mauler(o.position, PhysicalWorld);
     contents.Add(m);
 }
示例#3
0
文件: Ship.cs 项目: scastle/Solitude
 private void ItemIsTerminal(ObjectListItem o)
 {
     string[] s = o.moreInfo.ToArray();
     Terminal t = new Terminal(o.position, PhysicalWorld, s[0]);
     contents.Add(t);
 }
示例#4
0
 // Constructors
 public ObjectListCommandEventArgs(ObjectListItem item, object commandSource, System.Web.UI.WebControls.CommandEventArgs originalArgs)
 {
 }
示例#5
0
文件: Ship.cs 项目: scastle/Solitude
 private void ItemIsDoor(ObjectListItem o)
 {
     WallType t;
                 Direction d;
                 string[] s = o.moreInfo.ToArray();
                 switch(s[0]){
                     case "HandHold":
                         t = WallType.HandHold; break;
                     case "Grip":
                         t = WallType.Grip; break;
                     case "Smooth":
                         t = WallType.Smooth; break;
                     case "Metal":
                         t = WallType.Metal; break;
                     case "Hot":
                         t = WallType.Hot; break;
                     case "Cold":
                         t = WallType.Cold; break;
                     case "Spike":
                         t = WallType.Spike; break;
                     default:    t = WallType.Smooth; break;
                 }
                 switch (s[1])
                 {
                     case "Up":
                         d = Direction.Up; break;
                     case "Down":
                         d = Direction.Down; break;
                     case "Left":
                         d = Direction.Left; break;
                     default:
                         d = Direction.Right; break;
                 }
                 o.dimensions = new Vector2(32, 200);
     Door door = new Door(o.position, PhysicalWorld, o.dimensions.X, o.dimensions.Y, 1, t, d);
     contents.Add(door);
 }
 public int IndexOf(ObjectListItem item)
 {
 }
	// Constructors
	public ObjectListCommandEventArgs(ObjectListItem item, object commandSource, System.Web.UI.WebControls.CommandEventArgs originalArgs) {}
示例#8
0
 // Constructors
 public ObjectListSelectEventArgs(ObjectListItem item, bool selectMore)
 {
 }
	// Constructors
	public ObjectListDataBindEventArgs(ObjectListItem item, object dataItem) {}
示例#10
0
/*--------------------------------------------------------------------------*/

        public void Delete(ObjectListItem <T> item)
        {
            Disconnect(item);
        }
	// Constructors
	public ObjectListShowCommandsEventArgs(ObjectListItem item, ObjectListCommandCollection commands) {}
示例#12
0
        private void RenderItemDetailsWithTableTags(HtmlMobileTextWriter writer, ObjectListItem item)
        {
            Style style1 = base.Style;
            Style style2 = Control.LabelStyle;
            Style style3 = Control.CommandStyle;
            Color color  = (Color)style1[Style.ForeColorKey, true];

            writer.Write("<table border=0 width=\"100%\">\r\n<tr><td colspan=2>");
            writer.BeginStyleContext();
            writer.EnterStyle(style2);
            writer.WriteText(item[Control.LabelFieldIndex], true);
            writer.ExitStyle(style2);
            writer.EndStyleContext();
            writer.Write("</td></tr>\r\n<tr>");
            RenderRule(writer, color, 2);
            IObjectListFieldCollection iObjectListFieldCollection = Control.AllFields;
            int         i           = 0;
            IEnumerator iEnumerator = iObjectListFieldCollection.GetEnumerator();

            while (iEnumerator.MoveNext())
            {
                ObjectListField objectListField = (ObjectListField)iEnumerator.Current;
                if (objectListField.Visible)
                {
                    writer.Write("<tr><td>");
                    writer.BeginStyleContext();
                    writer.EnterStyle(base.Style);
                    writer.WriteText(objectListField.Title, true);
                    writer.ExitStyle(base.Style);
                    writer.EndStyleContext();
                    writer.Write("</td><td>");
                    writer.BeginStyleContext();
                    writer.EnterStyle(style1);
                    if (objectListField.Name == "CALL")
                    {
                        writer.WriteText(HtmlcheckPhonenumber(item[i]), false);
                    }
                    else if (objectListField.Name == "MAIL")
                    {
                        writer.WriteText(HtmlMail(item[i]), false);
                    }
                    else
                    {
                        writer.WriteText(item[i], false);
                    }
                    writer.ExitStyle(style1);
                    writer.EndStyleContext();
                    writer.Write("</td></tr>\r\n");
                }
                i++;
            }
            RenderRule(writer, color, 2);
            writer.Write("<tr><td colspan=2>");
            writer.BeginStyleContext();
            BooleanOption booleanOption = style3.Font.Italic;

            style3.Font.Italic = BooleanOption.False;
            writer.EnterStyle(style3);
            writer.Write("[&nbsp;");
            writer.ExitStyle(style3);
            style3.Font.Italic = booleanOption;
            writer.EnterStyle(style3);
            iEnumerator = Control.Commands.GetEnumerator();
            while (iEnumerator.MoveNext())
            {
                ObjectListCommand objectListCommand = (ObjectListCommand)iEnumerator.Current;
                RenderPostBackEventAsAnchor(writer, objectListCommand.Name, objectListCommand.Text, style3);
                writer.Write("&nbsp;|&nbsp;");
            }

            string str = (Control.BackCommandText != String.Empty) ? Control.BackCommandText : base.GetDefaultLabel(ControlAdapter.BackLabel);

            RenderPostBackEventAsAnchor(writer, BackToList, str, style3);
            writer.ExitStyle(style3);
            style3.Font.Italic = BooleanOption.False;
            writer.EnterStyle(style3);
            writer.Write("&nbsp;]");
            writer.ExitStyle(style3);
            style3.Font.Italic = booleanOption;
            writer.EndStyleContext();
            writer.Write("</td></tr></table>");
        }
示例#13
0
        private void RenderItemDetailsWithoutTableTags(HtmlMobileTextWriter writer, ObjectListItem item)
        {
            Style style1 = base.Style;
            Style style2 = Control.LabelStyle;
            Style style3 = Control.CommandStyle;

            writer.EnterStyle(style2);
            writer.WriteText(item[Control.LabelFieldIndex], true);
            writer.ExitStyle(style2, true);
            IObjectListFieldCollection iObjectListFieldCollection = Control.AllFields;
            int  i    = 0;
            bool flag = style1.Font.Bold == BooleanOption.True;

            writer.EnterStyle(style1);
            IEnumerator iEnumerator = iObjectListFieldCollection.GetEnumerator();

            while (iEnumerator.MoveNext())
            {
                ObjectListField objectListField = (ObjectListField)iEnumerator.Current;
                if (objectListField.Visible)
                {
                    if (!flag)
                    {
                        writer.Write("<b>");
                    }
                    writer.WriteText(String.Concat(objectListField.Title, ":"), true);
                    if (!flag)
                    {
                        writer.Write("</b>");
                    }
                    writer.Write("&nbsp;");
                    if (objectListField.Name == "CALL")
                    {
                        writer.WriteText(HtmlcheckPhonenumber(item[i]), true);
                    }
                    else if (objectListField.Name == "MAIL")
                    {
                        writer.WriteText(HtmlMail(item[i]), true);
                    }
                    else
                    {
                        writer.WriteText(item[i], true);
                    }
                    writer.WriteBreak();
                }
                i++;
            }

            writer.ExitStyle(style1);
            BooleanOption booleanOption = style3.Font.Italic;

            style3.Font.Italic = BooleanOption.False;
            writer.EnterStyle(style3);
            writer.Write("[&nbsp;");
            writer.ExitStyle(style3);
            style3.Font.Italic = booleanOption;
            writer.EnterStyle(style3);
            iEnumerator = Control.Commands.GetEnumerator();
            while (iEnumerator.MoveNext())
            {
                ObjectListCommand objectListCommand = (ObjectListCommand)iEnumerator.Current;
                RenderPostBackEventAsAnchor(writer, objectListCommand.Name, objectListCommand.Text, style3);
                writer.Write("&nbsp;|&nbsp;");
            }

            string str = (Control.BackCommandText != String.Empty) ? Control.BackCommandText : base.GetDefaultLabel(ControlAdapter.BackLabel);

            RenderPostBackEventAsAnchor(writer, BackToList, str, style3);
            writer.ExitStyle(style3);
            style3.Font.Italic = BooleanOption.False;
            writer.EnterStyle(style3);
            writer.Write("&nbsp;]");
            writer.ExitStyle(style3, Control.BreakAfter);
            style3.Font.Italic = booleanOption;
        }
 // Constructors
 public ObjectListDataBindEventArgs(ObjectListItem item, object dataItem)
 {
 }
        private void RenderItemsListWithTableTags(HtmlMobileTextWriter writer)
        {
            int pageStart = Control.FirstVisibleItemIndex;
            int pageSize  = Control.VisibleItemCount;
            ObjectListItemCollection items = Control.Items;

            // Determine how to render.
            bool shouldRenderAsTable    = ShouldRenderAsTable();
            bool hasDefaultCommand      = HasDefaultCommand();
            bool onlyHasDefaultCommand  = OnlyHasDefaultCommand();
            bool requiresDetailsScreen  = HasItemDetails() || (!onlyHasDefaultCommand && HasCommands());
            bool itemRequiresHyperlink  = requiresDetailsScreen || hasDefaultCommand;
            bool itemRequiresMoreButton = requiresDetailsScreen && hasDefaultCommand;

            int fieldCount;

            int[] fieldIndices = new int[] {};
            if (shouldRenderAsTable)
            {
                fieldIndices = Control.TableFieldIndices;
            }
            Debug.Assert(fieldIndices != null, "fieldIndices is null");
            fieldCount = fieldIndices.Length;

            if (fieldCount == 0)
            {
                fieldIndices    = new int[1];
                fieldIndices[0] = Control.LabelFieldIndex;
                fieldCount      = 1;
            }

            Style style           = this.Style;
            Style subCommandStyle = Control.CommandStyle;
            Style labelStyle      = Control.LabelStyle;
            Color foreColor       = (Color)style[Style.ForeColorKey, true];

            writer.BeginStyleContext();
            writer.WriteLine("<table border=0 width=\"100%\">\r\n<tr>");
            for (int field = 0; field < fieldCount; field++)
            {
                writer.Write("<td>");
                writer.BeginStyleContext();
                writer.EnterStyle(labelStyle);
                writer.WriteText(Control.AllFields[fieldIndices[field]].Title, true);
                writer.ExitStyle(labelStyle);
                writer.EndStyleContext();
                writer.Write("</td>");
            }
            if (itemRequiresMoreButton)
            {
                writer.WriteLine("<td/>");
            }
            writer.WriteLine("\r\n</tr>");
            RenderRule(writer, foreColor, fieldCount + 1);

            for (int i = 0; i < pageSize; i++)
            {
                ObjectListItem item = items[pageStart + i];
                writer.WriteLine("<tr>");
                for (int field = 0; field < fieldCount; field++)
                {
                    writer.Write("<td>");
                    if (field == 0 && itemRequiresHyperlink)
                    {
                        writer.BeginStyleContext();
                        writer.EnterStyle(style);
                        String eventArgument =
                            hasDefaultCommand ?
                            item.Index.ToString(CultureInfo.InvariantCulture) :
                            String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index.ToString(CultureInfo.InvariantCulture));
                        RenderPostBackEventAsAnchor(writer,
                                                    eventArgument,
                                                    item[fieldIndices[0]]);
                        writer.ExitStyle(style);
                        writer.EndStyleContext();
                    }
                    else
                    {
                        writer.BeginStyleContext();
                        writer.EnterStyle(style);
                        writer.WriteText(item[fieldIndices[field]], true);
                        writer.ExitStyle(style);
                        writer.EndStyleContext();
                    }
                    writer.WriteLine("</td>");
                }

                if (itemRequiresMoreButton)
                {
                    writer.Write("<td align=right>");
                    writer.BeginStyleContext();
                    writer.EnterFormat(subCommandStyle);
                    String moreText = Control.MoreText.Length == 0 ?
                                      GetDefaultLabel(MoreLabel) :
                                      Control.MoreText;
                    RenderPostBackEventAsAnchor(writer,
                                                String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index),
                                                moreText,
                                                subCommandStyle);
                    writer.ExitFormat(subCommandStyle);
                    writer.EndStyleContext();
                    writer.Write("</td>\r\n");
                }

                writer.WriteLine("</tr>");
            }

            RenderRule(writer, foreColor, fieldCount + 1);

            writer.Write("</table>\r\n");
            writer.EndStyleContext();
        }
	// Constructors
	public ObjectListSelectEventArgs(ObjectListItem item, bool selectMore) {}
        private void RenderItemDetailsWithTableTags(HtmlMobileTextWriter writer, ObjectListItem item)
        {
            Style style           = this.Style;
            Style labelStyle      = Control.LabelStyle;
            Style subCommandStyle = Control.CommandStyle;
            Color foreColor       = (Color)style[Style.ForeColorKey, true];

            writer.Write("<table border=0 width=\"100%\">\r\n<tr><td colspan=2>");
            writer.BeginStyleContext();
            writer.EnterStyle(labelStyle);
            writer.WriteText(item[Control.LabelFieldIndex], true);
            writer.ExitStyle(labelStyle);
            writer.EndStyleContext();
            writer.Write("</td></tr>\r\n<tr>");
            RenderRule(writer, foreColor, 2);

            IObjectListFieldCollection fields = Control.AllFields;
            int fieldIndex = 0;

            foreach (ObjectListField field in fields)
            {
                if (field.Visible)
                {
                    writer.Write("<tr><td>");
                    writer.BeginStyleContext();
                    writer.EnterStyle(Style);
                    writer.WriteText(field.Title, true);
                    writer.ExitStyle(Style);
                    writer.EndStyleContext();
                    writer.Write("</td><td>");
                    writer.BeginStyleContext();
                    writer.EnterStyle(style);
                    writer.WriteText(item[fieldIndex], true);
                    writer.ExitStyle(style);
                    writer.EndStyleContext();
                    writer.Write("</td></tr>\r\n");
                }
                fieldIndex++;
            }

            RenderRule(writer, foreColor, 2);

            writer.Write("<tr><td colspan=2>");
            writer.BeginStyleContext();
            BooleanOption cachedItalic = subCommandStyle.Font.Italic;

            subCommandStyle.Font.Italic = BooleanOption.False;
            writer.EnterStyle(subCommandStyle);
            writer.Write("[&nbsp;");
            writer.ExitStyle(subCommandStyle);
            subCommandStyle.Font.Italic = cachedItalic;
            writer.EnterStyle(subCommandStyle);

            ObjectListCommandCollection commands = Control.Commands;

            foreach (ObjectListCommand command in commands)
            {
                RenderPostBackEventAsAnchor(writer, command.Name, command.Text, subCommandStyle);
                writer.Write("&nbsp;|&nbsp;");
            }
            String backCommandText = Control.BackCommandText.Length == 0 ?
                                     GetDefaultLabel(BackLabel) :
                                     Control.BackCommandText;

            RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, subCommandStyle);
            writer.ExitStyle(subCommandStyle);
            subCommandStyle.Font.Italic = BooleanOption.False;
            writer.EnterStyle(subCommandStyle);
            writer.Write("&nbsp;]");
            writer.ExitStyle(subCommandStyle);
            subCommandStyle.Font.Italic = cachedItalic;

            writer.EndStyleContext();
            writer.Write("</td></tr></table>");
        }
	public bool Contains(ObjectListItem item) {}
	// Methods
	public void DataBindItem(int fieldIndex, ObjectListItem item) {}
	public int IndexOf(ObjectListItem item) {}
	public ObjectListCommandEventArgs(ObjectListItem item, string commandName) {}
 // Constructors
 public ObjectListShowCommandsEventArgs(ObjectListItem item, ObjectListCommandCollection commands)
 {
 }
示例#23
0
 public ObjectListCommandEventArgs(ObjectListItem item, string commandName)
 {
 }
        // Render the details view
        /// <include file='doc\XhtmlBasicObjectListAdapter.uex' path='docs/doc[@for="XhtmlObjectListAdapter.RenderItemDetails"]/*' />
        protected virtual void RenderItemDetails(XhtmlMobileTextWriter writer, ObjectListItem item)
        {
            if (Control.AllFields.Count == 0)
            {
                return;
            }
            if (!Device.Tables)
            {
                RenderItemDetailsWithoutTableTags(writer, item);
                return;
            }


            Style labelStyle              = Control.LabelStyle;
            Style subCommandStyle         = Control.CommandStyle;
            Style subCommandStyleNoItalic = (Style)subCommandStyle.Clone();

            subCommandStyleNoItalic.Font.Italic = BooleanOption.False;

            writer.ClearPendingBreak(); // we are writing a block level element in all cases.
            ConditionalEnterLayout(writer, Style);
            writer.WriteBeginTag("table");
            ConditionalRenderClassAttribute(writer);
            writer.Write(">");
            writer.Write("<tr><td colspan=\"2\">");
            ConditionalEnterStyle(writer, labelStyle);
            writer.WriteEncodedText(item[Control.LabelFieldIndex]);
            ConditionalExitStyle(writer, labelStyle);
            writer.WriteLine("</td></tr>");
            Color foreColor = (Color)Style[Style.ForeColorKey, true];

            RenderRule(writer, foreColor, 2);
            RenderItemFieldsInDetailsView(writer, item);
            RenderRule(writer, foreColor, 2);
            ConditionalPopPhysicalCssClass(writer);
            writer.WriteEndTag("table");
            ConditionalExitLayout(writer, Style);

            ConditionalEnterStyle(writer, subCommandStyleNoItalic);
            writer.Write("[&nbsp;");

            ObjectListCommandCollection commands = Control.Commands;
            String cssClass        = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
            String subCommandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute);

            if (subCommandClass == null || subCommandClass.Length == 0)
            {
                subCommandClass = cssClass;
            }

            foreach (ObjectListCommand command in commands)
            {
                RenderPostBackEventAsAnchor(writer, command.Name, command.Text, null /* accessKey */, subCommandStyle, subCommandClass);
                writer.Write("&nbsp;|&nbsp;");
            }
            String controlBCT      = Control.BackCommandText;
            String backCommandText = (controlBCT == null || controlBCT.Length == 0) ?
                                     GetDefaultLabel(BackLabel) :
                                     controlBCT;

            RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, null /* accessKey */, subCommandStyle, subCommandClass);
            writer.Write("&nbsp;]");
            ConditionalExitStyle(writer, subCommandStyleNoItalic);
        }
示例#25
0
文件: Ship.cs 项目: scastle/Solitude
 private void ItemIsFighter(ObjectListItem o)
 {
     SolitudeObjects.Enemies.Fighter f = new SolitudeObjects.Enemies.Fighter(o.position, PhysicalWorld);
     contents.Add(f);
 }
        private void RenderItemDetailsWithoutTableTags(XhtmlMobileTextWriter writer, ObjectListItem item)
        {
            if (Control.VisibleItemCount == 0)
            {
                return;
            }

            Style style                   = this.Style;
            Style labelStyle              = Control.LabelStyle;
            Style subCommandStyle         = Control.CommandStyle;
            Style subCommandStyleNoItalic = (Style)subCommandStyle.Clone();

            subCommandStyleNoItalic.Font.Italic = BooleanOption.False;

            ConditionalRenderOpeningDivElement(writer);

            String cssClass   = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
            String labelClass = GetCustomAttributeValue(XhtmlConstants.CssLabelClassCustomAttribute);

            if (labelClass == null || labelClass.Length == 0)
            {
                labelClass = cssClass;
            }
            ConditionalEnterStyle(writer, labelStyle);
            bool requiresLabelClassSpan = CssLocation == StyleSheetLocation.PhysicalFile && labelClass != null && labelClass.Length > 0;

            if (requiresLabelClassSpan)
            {
                writer.WriteBeginTag("span");
                writer.WriteAttribute("class", labelClass, true);
                writer.Write(">");
            }
            writer.Write(item[Control.LabelFieldIndex]);
            writer.SetPendingBreak();
            if (requiresLabelClassSpan)
            {
                writer.WriteEndTag("span");
            }
            ConditionalExitStyle(writer, labelStyle);
            writer.WritePendingBreak();

            IObjectListFieldCollection fields = Control.AllFields;
            int fieldIndex = 0;

            ConditionalEnterStyle(writer, style);
            foreach (ObjectListField field in fields)
            {
                if (field.Visible)
                {
                    writer.Write(field.Title + ":");
                    writer.Write("&nbsp;");
                    writer.Write(item[fieldIndex]);
                    writer.WriteBreak();
                }
                fieldIndex++;
            }
            ConditionalExitStyle(writer, style);

            String commandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute);

            ConditionalEnterStyle(writer, subCommandStyleNoItalic);
            if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true")
            {
                writer.Write("[&nbsp;");
            }
            ConditionalEnterStyle(writer, subCommandStyle);

            ObjectListCommandCollection commands = Control.Commands;

            foreach (ObjectListCommand command in commands)
            {
                RenderPostBackEventAsAnchor(writer, command.Name, command.Text);
                if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true")
                {
                    writer.Write("&nbsp;|&nbsp;");
                }
            }
            String controlBCT      = Control.BackCommandText;
            String backCommandText = controlBCT == null || controlBCT.Length == 0 ?
                                     GetDefaultLabel(BackLabel) :
                                     Control.BackCommandText;

            RenderPostBackEventAsAnchor(writer, BackToList, backCommandText);
            ConditionalExitStyle(writer, subCommandStyle);
            if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true")
            {
                writer.Write("&nbsp;]");
            }
            ConditionalExitStyle(writer, subCommandStyleNoItalic);

            ConditionalRenderClosingDivElement(writer);
        }
示例#27
0
文件: Ship.cs 项目: scastle/Solitude
 private void ItemIsSentinel(ObjectListItem o)
 {
     string[] s = o.moreInfo.ToArray();
     int i;
     switch (s[0])
     {
         case "3": i = 3; break;
         case "4": i = 4; break;
         default: i = 5; break;
     }
     SolitudeObjects.Enemies.Sentinel sn = new SolitudeObjects.Enemies.Sentinel(o.position, o.dimensions, PhysicalWorld, i);
     contents.Add(sn);
 }
        private void RenderItemsListWithoutTableTags(XhtmlMobileTextWriter writer)
        {
            if (Control.VisibleItemCount == 0)
            {
                return;
            }

            ConditionalRenderOpeningDivElement(writer);
            int startIndex = Control.FirstVisibleItemIndex;
            int pageSize   = Control.VisibleItemCount;
            ObjectListItemCollection   items     = Control.Items;
            IObjectListFieldCollection allFields = Control.AllFields;
            int count = allFields.Count;

            int nextStartIndex  = startIndex + pageSize;
            int labelFieldIndex = Control.LabelFieldIndex;


            Style  style      = this.Style;
            Style  labelStyle = Control.LabelStyle;
            String cssClass   = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
            String labelClass = GetCustomAttributeValue(XhtmlConstants.CssLabelClassCustomAttribute);

            if (labelClass == null || labelClass.Length == 0)
            {
                labelClass = cssClass;
            }
            ConditionalEnterStyle(writer, labelStyle);
            bool requiresLabelClassSpan = CssLocation == StyleSheetLocation.PhysicalFile && labelClass != null && labelClass.Length > 0;

            if (requiresLabelClassSpan)
            {
                writer.WriteBeginTag("span");
                writer.WriteAttribute("class", labelClass, true);
                writer.Write(">");
            }
            writer.Write(Control.AllFields[labelFieldIndex].Title);
            writer.SetPendingBreak();
            if (requiresLabelClassSpan)
            {
                writer.WriteEndTag("span");
            }
            ConditionalExitStyle(writer, labelStyle);
            writer.WritePendingBreak();

            bool hasDefaultCommand     = HasDefaultCommand();
            bool onlyHasDefaultCommand = OnlyHasDefaultCommand();
            bool requiresDetailsScreen = !onlyHasDefaultCommand && HasCommands();

            // if there is > 1 visible field, need a details screen
            for (int visibleFields = 0, i = 0; !requiresDetailsScreen && i < count; i++)
            {
                visibleFields        += allFields[i].Visible ? 1 : 0;
                requiresDetailsScreen =
                    requiresDetailsScreen || visibleFields > 1;
            }
            bool itemRequiresHyperlink  = requiresDetailsScreen || hasDefaultCommand;
            bool itemRequiresMoreButton = requiresDetailsScreen && hasDefaultCommand;


            Style subCommandStyle = Control.CommandStyle;

            subCommandStyle.Alignment = style.Alignment;
            subCommandStyle.Wrapping  = style.Wrapping;

            ConditionalEnterStyle(writer, style);
            for (int i = startIndex; i < nextStartIndex; i++)
            {
                ObjectListItem item = items[i];

                String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute);
                String itemClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute);
                if (itemRequiresHyperlink)
                {
                    RenderPostBackEventAsAnchor(writer,
                                                hasDefaultCommand ?
                                                item.Index.ToString(CultureInfo.InvariantCulture) :
                                                String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index),
                                                item[labelFieldIndex], accessKey, Style, cssClass);
                }
                else
                {
                    bool requiresItemClassSpan = CssLocation == StyleSheetLocation.PhysicalFile && itemClass != null && itemClass.Length > 0;
                    if (requiresItemClassSpan)
                    {
                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", itemClass, true);
                        writer.Write(">");
                    }
                    writer.Write(item[labelFieldIndex]);
                    if (requiresItemClassSpan)
                    {
                        writer.WriteEndTag("span");
                    }
                }

                if (itemRequiresMoreButton)
                {
                    String        commandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute);
                    BooleanOption cachedItalic = subCommandStyle.Font.Italic;
                    subCommandStyle.Font.Italic = BooleanOption.False;
                    ConditionalEnterFormat(writer, subCommandStyle);
                    if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true")
                    {
                        writer.Write(" [");
                    }
                    ConditionalExitFormat(writer, subCommandStyle);
                    subCommandStyle.Font.Italic = cachedItalic;
                    ConditionalEnterFormat(writer, subCommandStyle);
                    String controlMT = Control.MoreText;
                    String moreText  = (controlMT == null || controlMT.Length == 0) ?
                                       GetDefaultLabel(MoreLabel) :
                                       controlMT;
                    RenderPostBackEventAsAnchor(writer,
                                                String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index),
                                                moreText,
                                                null /*accessKey*/,
                                                subCommandStyle,
                                                commandClass);
                    ConditionalExitFormat(writer, subCommandStyle);
                    subCommandStyle.Font.Italic = BooleanOption.False;
                    ConditionalEnterFormat(writer, subCommandStyle);
                    if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true")
                    {
                        writer.Write("]");
                    }
                    ConditionalExitFormat(writer, subCommandStyle);
                    subCommandStyle.Font.Italic = cachedItalic;
                }

                if (i < (nextStartIndex - 1))
                {
                    writer.WriteBreak();
                }
                else
                {
                    writer.SetPendingBreak();
                }
            }
            ConditionalExitStyle(writer, style);
            ConditionalRenderClosingDivElement(writer);
        }
示例#29
0
文件: Ship.cs 项目: scastle/Solitude
        private void ItemIsTy(ObjectListItem o)
        {
            SolitudeObjects.Enemies.TyTaylor t = new SolitudeObjects.Enemies.TyTaylor(PhysicalWorld, o.position);
            contents.Add(t);

            bossFight = true;

            GameWorld.audio.StopSong();
            GameWorld.audio.SongPlay("breakbeat", true);
        }
示例#30
0
 private void ItemIsFighter(ObjectListItem o)
 {
     SolitudeObjects.Enemies.Fighter f = new SolitudeObjects.Enemies.Fighter(o.position, PhysicalWorld);
     contents.Add(f);
 }
        /// <include file='doc\WmlObjectListAdapter.uex' path='docs/doc[@for="WmlObjectListAdapter.RenderItemsList"]/*' />
        protected virtual void RenderItemsList(WmlMobileTextWriter writer)
        {
            bool rendersAcceptsInline      = Device.RendersWmlDoAcceptsInline;
            bool rendersSelectsAsMenuCards = Device.RendersWmlSelectsAsMenuCards;
            bool rendersBreaksAfterAnchor  = Device.RendersBreaksAfterWmlAnchor;
            int  pageStart = Control.FirstVisibleItemIndex;
            int  pageSize  = Control.VisibleItemCount;
            ObjectListItemCollection items = Control.Items;

            if (pageSize == 0 || items.Count == 0)
            {
                return;
            }

            bool hasDefaultCommand     = HasDefaultCommand();
            bool onlyHasDefaultCommand = OnlyHasDefaultCommand();
            bool requiresSecondScreen  = HasItemDetails() || (!onlyHasDefaultCommand && HasCommands());
            bool itemRequiresHyperlink = requiresSecondScreen || hasDefaultCommand;

            writer.EnterLayout(Style);

            int[] tableFieldIndices = null;
            if (ShouldRenderAsTable() && (tableFieldIndices = Control.TableFieldIndices).Length != 0)
            {
                writer.BeginCustomMarkup();
                int fieldCount = tableFieldIndices.Length;
                writer.Write("<table columns=\"");
                writer.Write(fieldCount.ToString(CultureInfo.InvariantCulture));
                writer.WriteLine("\">");

                if (ShouldRenderTableHeaders())
                {
                    writer.Write("<tr>");
                    foreach (int fieldIndex in tableFieldIndices)
                    {
                        writer.Write("<td>");
                        writer.RenderText(Control.AllFields[fieldIndex].Title);
                        writer.Write("</td>");
                    }
                    writer.WriteLine("</tr>");
                }

                for (int i = 0; i < pageSize; i++)
                {
                    ObjectListItem item = items[pageStart + i];
                    writer.Write("<tr>");
                    for (int field = 0; field < fieldCount; field++)
                    {
                        writer.Write("<td>");
                        if (field == 0 && itemRequiresHyperlink)
                        {
                            RenderPostBackEvent(writer,
                                                requiresSecondScreen ?
                                                String.Format(CultureInfo.InvariantCulture, _showMoreFormatAnchor, item.Index) :
                                                item.Index.ToString(CultureInfo.InvariantCulture),
                                                GetDefaultLabel(GoLabel),
                                                false,
                                                item[tableFieldIndices[0]],
                                                false,
                                                WmlPostFieldType.Raw);
                        }
                        else
                        {
                            writer.RenderText(item[tableFieldIndices[field]]);
                        }
                        writer.Write("</td>");
                    }
                    writer.WriteLine("</tr>");
                }
                writer.WriteLine("</table>");
                writer.EndCustomMarkup();
            }
            else
            {
                int             labelFieldIndex = Control.LabelFieldIndex;
                ObjectListField labelField      = Control.AllFields[labelFieldIndex];

                writer.EnterFormat(Style);
                for (int i = 0; i < pageSize; i++)
                {
                    ObjectListItem item = items[pageStart + i];
                    if (itemRequiresHyperlink)
                    {
                        RenderPostBackEvent(writer,
                                            requiresSecondScreen ?
                                            String.Format(CultureInfo.InvariantCulture, _showMoreFormatAnchor, item.Index) :
                                            item.Index.ToString(CultureInfo.InvariantCulture),
                                            GetDefaultLabel(GoLabel),
                                            false,
                                            item[labelFieldIndex],
                                            true,
                                            WmlPostFieldType.Raw);
                    }
                    else
                    {
                        writer.RenderText(item[labelFieldIndex], true);
                    }
                }
                writer.ExitFormat(Style);
            }

            writer.ExitLayout(Style);
        }
示例#32
0
 private void ItemIsMauler(ObjectListItem o)
 {
     SolitudeObjects.Enemies.Mauler m = new SolitudeObjects.Enemies.Mauler(o.position, PhysicalWorld);
     contents.Add(m);
 }
        private void RenderItemsListWithoutTableTags(HtmlMobileTextWriter writer)
        {
            int startIndex = Control.FirstVisibleItemIndex;
            int pageSize   = Control.VisibleItemCount;
            ObjectListItemCollection   items     = Control.Items;
            IObjectListFieldCollection allFields = Control.AllFields;
            int count = allFields.Count;

            int nextStartIndex  = startIndex + pageSize;
            int labelFieldIndex = Control.LabelFieldIndex;


            Style style      = this.Style;
            Style labelStyle = Control.LabelStyle;

            writer.EnterStyle(labelStyle);
            writer.WriteText(Control.AllFields[labelFieldIndex].Title, true);
            writer.ExitStyle(labelStyle, true);

            bool hasDefaultCommand     = HasDefaultCommand();
            bool onlyHasDefaultCommand = OnlyHasDefaultCommand();
            bool requiresDetailsScreen = !onlyHasDefaultCommand && HasCommands();

            // if there is > 1 visible field, need a details screen
            for (int visibleFields = 0, i = 0; !requiresDetailsScreen && i < count; i++)
            {
                visibleFields        += allFields[i].Visible ? 1 : 0;
                requiresDetailsScreen =
                    requiresDetailsScreen || visibleFields > 1;
            }
            bool itemRequiresHyperlink  = requiresDetailsScreen || hasDefaultCommand;
            bool itemRequiresMoreButton = requiresDetailsScreen && hasDefaultCommand;


            Style subCommandStyle = Control.CommandStyle;

            subCommandStyle.Alignment = style.Alignment;
            subCommandStyle.Wrapping  = style.Wrapping;

            writer.EnterStyle(style);
            for (int i = startIndex; i < nextStartIndex; i++)
            {
                ObjectListItem item = items[i];

                if (itemRequiresHyperlink)
                {
                    RenderPostBackEventAsAnchor(writer,
                                                hasDefaultCommand ?
                                                item.Index.ToString(CultureInfo.InvariantCulture) :
                                                String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index),
                                                item[labelFieldIndex]);
                }
                else
                {
                    writer.WriteText(item[labelFieldIndex], true);
                }

                if (itemRequiresMoreButton)
                {
                    BooleanOption cachedItalic = subCommandStyle.Font.Italic;
                    subCommandStyle.Font.Italic = BooleanOption.False;
                    writer.EnterFormat(subCommandStyle);
                    writer.Write(" [");
                    writer.ExitFormat(subCommandStyle);
                    subCommandStyle.Font.Italic = cachedItalic;
                    writer.EnterFormat(subCommandStyle);
                    String moreText = Control.MoreText.Length == 0 ?
                                      GetDefaultLabel(MoreLabel) :
                                      Control.MoreText;
                    writer.WriteBeginTag("a");
                    RenderPostBackEventAsAttribute(writer, "href", String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index));
                    writer.Write(">");
                    writer.WriteText(moreText, true);
                    writer.WriteEndTag("a");
                    writer.ExitFormat(subCommandStyle);
                    subCommandStyle.Font.Italic = BooleanOption.False;
                    writer.EnterFormat(subCommandStyle);
                    writer.Write("]");
                    writer.ExitFormat(subCommandStyle);
                    subCommandStyle.Font.Italic = cachedItalic;
                }

                if (i < (nextStartIndex - 1))
                {
                    writer.WriteBreak();
                }
            }
            writer.ExitStyle(style, Control.BreakAfter);
        }
 // Methods
 public void DataBindItem(int fieldIndex, ObjectListItem item)
 {
 }
        private void RenderItemDetailsWithoutTableTags(HtmlMobileTextWriter writer, ObjectListItem item)
        {
            Style style           = this.Style;
            Style labelStyle      = Control.LabelStyle;
            Style subCommandStyle = Control.CommandStyle;

            writer.EnterStyle(labelStyle);
            writer.WriteText(item[Control.LabelFieldIndex], true);
            writer.ExitStyle(labelStyle, true);

            IObjectListFieldCollection fields = Control.AllFields;
            int  fieldIndex  = 0;
            bool boldInStyle =
                (style.Font.Bold == BooleanOption.True) ? true : false;

            writer.EnterStyle(style);
            foreach (ObjectListField field in fields)
            {
                if (field.Visible)
                {
                    if (!boldInStyle)
                    {
                        writer.Write("<b>");
                    }
                    writer.WriteText(field.Title + ":", true);
                    if (!boldInStyle)
                    {
                        writer.Write("</b>");
                    }
                    writer.Write("&nbsp;");
                    writer.WriteText(item[fieldIndex], true);
                    writer.WriteBreak();
                }
                fieldIndex++;
            }
            writer.ExitStyle(style);

            BooleanOption cachedItalic = subCommandStyle.Font.Italic;

            subCommandStyle.Font.Italic = BooleanOption.False;
            writer.EnterStyle(subCommandStyle);
            writer.Write("[&nbsp;");
            writer.ExitStyle(subCommandStyle);
            subCommandStyle.Font.Italic = cachedItalic;
            writer.EnterStyle(subCommandStyle);

            ObjectListCommandCollection commands = Control.Commands;

            foreach (ObjectListCommand command in commands)
            {
                RenderPostBackEventAsAnchor(writer, command.Name, command.Text, subCommandStyle);
                writer.Write("&nbsp;|&nbsp;");
            }
            String backCommandText = Control.BackCommandText.Length == 0 ?
                                     GetDefaultLabel(BackLabel) :
                                     Control.BackCommandText;

            RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, subCommandStyle);
            writer.ExitStyle(subCommandStyle);
            subCommandStyle.Font.Italic = BooleanOption.False;
            writer.EnterStyle(subCommandStyle);
            writer.Write("&nbsp;]");
            writer.ExitStyle(subCommandStyle, Control.BreakAfter);
            subCommandStyle.Font.Italic = cachedItalic;
        }
 public bool Contains(ObjectListItem item)
 {
 }