예제 #1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            PlaceHolder1.Controls.Clear();
            var container = new ContentContainer();

            this.Content.InstantiateIn(container);
            PlaceHolder1.Controls.Add(container);
        }
예제 #2
0
 protected void Page_Init()
 {
     if (Content != null)
       {
     var c = new ContentContainer();
     Content.InstantiateIn(c);
     phContent.Controls.Add(c);
       }
 }
        private TextTreeNode CopyObjectNode(TextTreeObjectNode objectNode, out ContentContainer container)
        {
            // XamlWriter.Save demands unmanaged code permission. Since it's not safe to assert
            // here as custom type converters and value serializers can potentially execute
            // arbitrary code, we block the call to XamlWriter.Save in partial trust.
            if (SecurityHelper.CheckUnmanagedCodePermission())
            {
                string xml;

                xml = XamlWriter.Save(objectNode.EmbeddedElement);

                container = new ObjectContentContainer(xml, objectNode.EmbeddedElement);
            }
            else
            {
                container = new ObjectContentContainer(null, null);
            }

            return((TextTreeNode)objectNode.GetNextNode());
        }
        public static AbstractScorePage GetScorePage()
        {
            var header = new HeaderContainer(1200, 60);

            header.AddTitle("TEST TITLE");
            var footer = new FooterContainer(1200, 20);

            footer.AddCopyRights("COPYRIGHTS TEXT TEST");

            var contentContainer = new ContentContainer(1200, 600);
            var rowContainer     = new SimpleRowContainer(new System.Windows.Rect(0, 0, 1140, 100))
            {
                Y = 40
            };
            var rowContainer2 = new SimpleRowContainer(new System.Windows.Rect(0, 0, 1140, 100))
            {
                Y = 180
            };
            var rowContainer3 = new SimpleRowContainer(new System.Windows.Rect(0, 0, 1140, 100))
            {
                Y = 320
            };

            rowContainer.AddItem(new MeasurePrototypeItem(100));
            rowContainer2.AddItem(new MeasurePrototypeItem(100));
            rowContainer3.AddItem(new MeasurePrototypeItem(100));

            contentContainer.AddRowContainer(rowContainer);
            contentContainer.AddRowContainer(rowContainer2);
            contentContainer.AddRowContainer(rowContainer3);
            var pageElements = new List <AbstractPageElement> {
                header,
                contentContainer,
                footer
            };
            var pageLayout = new WrappedLayout(pageElements);
            var scorePage  = new StandardScorePage("ADVANCED_LAYOUT_TEST", pageLayout);

            scorePage.UpdateContent();
            return(scorePage);
        }
예제 #5
0
        public InventoryContainerItem AddSlot(int x, int y, int slotId, int inventoryId)
        {
            InventoryContainerItem containerItem = new InventoryContainerItem()
            {
                Margin                = new Thickness(x, y, 0, 0),
                InventoryIndex        = slotId,
                Anchor                = Alignment.TopLeft,
                AutoSizeMode          = AutoSizeMode.None,
                InventoryId           = inventoryId,
                HighlightedBackground = Color.White * 0.8f
            };

            containerItem.CursorEnter += ContainerItemOnCursorEnter;
            containerItem.CursorLeave += ContainerItemOnCursorLeave;

            containerItem.CursorPressed += ContainerItemOnCursorPressed;

            ContentContainer.AddChild(containerItem);

            return(containerItem);
        }
예제 #6
0
        private void subPanelStateChanged(SettingsSubPanel panel, ValueChangedEvent <Visibility> state)
        {
            switch (state.NewValue)
            {
            case Visibility.Visible:
                Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint);

                SectionsContainer.FadeOut(300, Easing.OutQuint);
                ContentContainer.MoveToX(-PANEL_WIDTH, 500, Easing.OutQuint);

                lastOpenedSubPanel = panel;
                break;

            case Visibility.Hidden:
                Sidebar?.FadeColour(Color4.White, 300, Easing.OutQuint);

                SectionsContainer.FadeIn(500, Easing.OutQuint);
                ContentContainer.MoveToX(0, 500, Easing.OutQuint);
                break;
            }
        }
예제 #7
0
        private void keyBindingOverlay_StateChanged(Visibility visibility)
        {
            switch (visibility)
            {
            case Visibility.Visible:
                Background.FadeTo(0.9f, 300, Easing.OutQuint);
                Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint);

                SectionsContainer.FadeOut(300, Easing.OutQuint);
                ContentContainer.MoveToX(-WIDTH, 500, Easing.OutQuint);
                break;

            case Visibility.Hidden:
                Background.FadeTo(0.6f, 500, Easing.OutQuint);
                Sidebar?.FadeColour(Color4.White, 300, Easing.OutQuint);

                SectionsContainer.FadeIn(500, Easing.OutQuint);
                ContentContainer.MoveToX(0, 500, Easing.OutQuint);
                break;
            }
        }
예제 #8
0
        private void subPanelStateChanged(ValueChangedEvent <Visibility> state)
        {
            switch (state.NewValue)
            {
            case Visibility.Visible:
                Background.FadeTo(0.9f, 300, Easing.OutQuint);
                Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint);

                SectionsContainer.FadeOut(300, Easing.OutQuint);
                ContentContainer.MoveToX(-WIDTH, 500, Easing.OutQuint);
                break;

            case Visibility.Hidden:
                Background.FadeTo(0.6f, 500, Easing.OutQuint);
                Sidebar?.FadeColour(Color4.White, 300, Easing.OutQuint);

                SectionsContainer.FadeIn(500, Easing.OutQuint);
                ContentContainer.MoveToX(0, 500, Easing.OutQuint);
                break;
            }
        }
예제 #9
0
        protected virtual void ModelChanged(object sender, ContentOwnerEventArgs <ModelInstance> e)
        {
            ContentContainer cc = ContentContainer.Instance();

            switch (e.Action)
            {
            case ContentAction.Add:
                instance = cc.GetModel(modelName);
                break;

            case ContentAction.Rename:
                ModelName = e.NewName;
                break;

            case ContentAction.Remove:
                instance = null;
                break;

            case ContentAction.Replace:
                break;
            }
        }
예제 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Shell"/> class.
        /// </summary>
        public Shell()
        {
            try
            {
                this.InitializeComponent();

                // Setup SideDrawer
                ContentContainer.SetupInteraction();

                Messenger.Default.Register <GuildNavigateMessage>(this, m =>
                {
                    ContentContainer.OpenLeft();
                });

                Messenger.Default.Register <ChannelNavigateMessage>(this, m =>
                {
                    ContentContainer.CloseLeft();
                });

                Messenger.Default.Register <GatewayMessageRecievedMessage>(this, async m =>
                {
                    if (SimpleIoc.Default.GetInstance <ISettingsService>().Roaming.GetValue <bool>(SettingKeys.MentionGlow) &&
                        (m.Message.MentionEveryone ||
                         m.Message.Mentions.Any(x => x.Id == SimpleIoc.Default.GetInstance <ICurrentUserService>().CurrentUser.Model.Id)))
                    {
                        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                        {
                            FlashMention.Begin();
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                var logger = App.ServiceProvider.GetService <ILogger <Shell> >();

                do
                {
                    logger.LogError(default, ex, "Error constructing Shell");
예제 #11
0
        public ScrollView()
        {
            RepaintMode = ControlRepaintMode.Never;

            hScrollBar = new ScrollBar {
                Orientation = ScrollBarOrientation.Horizontal
            };
            vScrollBar = new ScrollBar {
                Orientation = ScrollBarOrientation.Vertical
            };
            contentContainer = new ContentContainer(hScrollBar, vScrollBar);

            AddChild(contentContainer);
            AddChild(vScrollBar);
            AddChild(hScrollBar);

            hScrollBar.MinValue = 0;
            vScrollBar.MinValue = 0;

            hScrollBar.ValueChanged += (_, __) => contentContainer.ContentLocation = new Point(-hScrollBar.Value, -vScrollBar.Value);
            vScrollBar.ValueChanged += (_, __) => contentContainer.ContentLocation = new Point(-hScrollBar.Value, -vScrollBar.Value);
        }
예제 #12
0
            public void AddLog(string log)
            {
                Console.WriteLine($"{log}");
                var txt = new TextLabel
                {
                    Text = log
                };

                ContentContainer.Add(txt);
                if (ContentContainer.Children.Count > 30)
                {
                    var remove = ContentContainer.Children.GetRange(0, 10);
                    foreach (var child in remove)
                    {
                        ContentContainer.Remove(child);
                    }
                }
                ElmSharp.EcoreMainloop.Post(() =>
                {
                    ScrollTo((ContentContainer.Children.Count) * (txt.NaturalSize.Height), true);
                });
            }
예제 #13
0
        private void UpdateContent()
        {
            //The reason of changing the content from the code behind like this is due to a bug of WPF
            //  The bug if when you set the max width of an existing text box and then try to get the
            //  expected size of it by using TextBox.Measure(..) method it will return the wrong value.
            //  The only solution that I can come up for now is clean the StackPanel content and
            //  then add a new TextBox to it

            ContentContainer.Children.Clear();

            if (ViewModel == null)
            {
                return;
            }

            TextBox textBox = GetNewTextBox(ViewModel.Content);

            ContentContainer.Children.Add(textBox);

            ContentContainer.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
            ViewModel.EstimatedWidth  = ContentContainer.DesiredSize.Width;
            ViewModel.EstimatedHeight = ContentContainer.DesiredSize.Height;
        }
예제 #14
0
        private void UpdateShape()
        {
            ContentContainer.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
            double estimatedHeight = ContentContainer.DesiredSize.Height;
            double estimatedWidth  = ContentContainer.DesiredSize.Width;

            PointCollection framePoints = new PointCollection();

            switch (ViewModel.InfoBubbleStyle)
            {
            case InfoBubbleViewModel.Style.LibraryItemPreview:
                framePoints = GetFramePoints_LibraryItemPreview(estimatedHeight, estimatedWidth);
                break;

            case InfoBubbleViewModel.Style.NodeTooltip:
                framePoints = GetFramePoints_NodeTooltip(estimatedHeight, estimatedWidth);
                break;

            case InfoBubbleViewModel.Style.Error:
            case InfoBubbleViewModel.Style.ErrorCondensed:
                framePoints = GetFramePoints_Error(estimatedHeight, estimatedWidth);
                break;

            case InfoBubbleViewModel.Style.Preview:
            case InfoBubbleViewModel.Style.PreviewCondensed:
                framePoints = GetFramePoints_Preview(estimatedHeight, estimatedWidth);
                break;

            case InfoBubbleViewModel.Style.None:
                break;
            }

            if (framePoints != null)
            {
                backgroundPolygon.Points = framePoints;
            }
        }
        // Copies a run of text into a ContentContainer.
        // Returns the next node to examine.
        private TextTreeNode CopyTextNode(TextTreeTextNode textNode, TextTreeNode haltNode, out ContentContainer container)
        {
            SplayTreeNode node;

            char[] text;
            int    count;
            int    symbolOffset;

            Invariant.Assert(textNode != haltNode, "Expect at least one node to copy!");

            symbolOffset = textNode.GetSymbolOffset(this.TextContainer.Generation);

            // Get a count of all the characters we're about to copy.
            count = 0;
            node  = textNode;

            do
            {
                count += textNode.SymbolCount;

                node     = textNode.GetNextNode();
                textNode = node as TextTreeTextNode;
            }while (textNode != null && textNode != haltNode);

            // Allocate storage.
            text = new char[count];

            // Copy the text.
            TextTreeText.ReadText(this.TextContainer.RootTextBlock, symbolOffset, count, text, 0 /*startIndex*/);

            container = new TextContentContainer(text);

            return((TextTreeNode)node);
        }
예제 #16
0
        public GuiPlayerInventoryDialog(Player player, Inventory inventory) : base(inventory, GuiTextures.InventoryPlayerBackground, 176, 166)
        {
            Player = player;

            // Subscribe to events

            if (player != null)
            {
                var modelRenderer = player.ModelRenderer;

                var mob = new PlayerMob(player.Name, player.Level, player.Network, player.ModelRenderer.Texture)
                {
                    ModelRenderer = modelRenderer,
                };

                ContentContainer.AddChild(
                    _playerEntityModelView = new GuiEntityModelView(mob)
                {
                    Margin            = new Thickness(7, 25),
                    Width             = 49,
                    Height            = 70,
                    Anchor            = Alignment.TopLeft,
                    AutoSizeMode      = AutoSizeMode.None,
                    Background        = null,
                    BackgroundOverlay = null
                });
            }

            Color color = Color.Blue;

            foreach (var slot in AddSlots(8, 84, 9, 27, 9, 0x00))
            {
                //   slot.HighlightedBackground = new Microsoft.Xna.Framework.Color(color, 0.5f);
                slot.Item = Inventory[slot.InventoryIndex];
            }

            color = Color.Aqua;
            foreach (var slot in AddSlots(8, 142, 9, 9, 0, 0))
            {
                // slot.HighlightedBackground = new Microsoft.Xna.Framework.Color(color, 0.5f);
                slot.Item = Inventory[slot.InventoryIndex];
            }

            foreach (var slot in AddSlots(8, 8, 1, 4, 0, 120))
            {
                var  inventoryIndex = slot.InventoryIndex;
                Item item           = new ItemAir();

                switch (slot.InventoryIndex)
                {
                case 0:
                    item           = inventory.Helmet;
                    inventoryIndex = inventory.HelmetSlot;
                    break;

                case 1:
                    item           = inventory.Chestplate;
                    inventoryIndex = inventory.ChestSlot;
                    break;

                case 2:
                    item           = inventory.Leggings;
                    inventoryIndex = inventory.LeggingsSlot;
                    break;

                case 3:
                    item           = inventory.Boots;
                    inventoryIndex = inventory.BootsSlot;
                    break;
                }

                //  slot.HighlightedBackground = new Microsoft.Xna.Framework.Color(Color.Red, 0.5f);
                slot.Item           = item;
                slot.InventoryIndex = inventoryIndex;
            }

            foreach (var slot in AddSlots(98, 18, 2, 4, 41, 0))
            {
                slot.Item = Inventory[slot.InventoryIndex];
                //  slot.HighlightedBackground = new Microsoft.Xna.Framework.Color(Color.Purple, 0.5f);
            }

            CraftingOutput = AddSlot(154, 28, 45, 0);
            //  CraftingOutput.HighlightedBackground = new Microsoft.Xna.Framework.Color(Color.Purple, 0.5f);

            /*var shieldSlot = new InventoryContainerItem()
             * {
             *  HighlightedBackground = new Microsoft.Xna.Framework.Color(Color.Orange, 0.5f),
             *  Anchor = Alignment.TopLeft,
             *  Margin =  new Thickness(61, 76),
             *  AutoSizeMode = AutoSizeMode.None,
             *  Item = Inventory[40],
             *  InventoryIndex = 40
             * };
             *
             * ContentContainer.AddChild(shieldSlot);*/
        }
예제 #17
0
 /// <inheritdoc />
 /// <summary>
 /// </summary>
 public override void Destroy()
 {
     ContentContainer.Destroy();
     base.Destroy();
 }
예제 #18
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        uxMessagePlaceHolder.Controls.Clear();
        uxValidationSummaryPlaceHolder.Controls.Clear();
        uxValidationDenotePlaceHolder.Controls.Clear();
        uxLanguageControlPlaceHolder.Controls.Clear();
        uxButtonEventPlaceHolder.Controls.Clear();
        uxButtonCommandPlaceHolder.Controls.Clear();
        uxButtonEventInnerBoxPlaceHolder.Controls.Clear();
        uxTopContentBoxPlaceHolder.Controls.Clear();

        uxFilterPlaceHolder.Controls.Clear();
        uxSpecialFilterPlaceHolder.Controls.Clear();
        uxPageNumberPlaceHolder.Controls.Clear();
        uxGridPlaceHolder.Controls.Clear();
        uxBottomContentBoxPlaceHolder.Controls.Clear();

        uxContentPlaceHolder.Controls.Clear();

        // Message.
        ContentContainer container = new ContentContainer();

        if (MessageTemplate != null)
        {
            MessageTemplate.InstantiateIn(container);
            uxMessagePlaceHolder.Controls.Add(container);
            uxMessagePlaceHolder.Visible = true;
        }
        else
        {
            uxMessagePlaceHolder.Controls.Add(new LiteralControl("No Message Defined"));
            uxMessagePlaceHolder.Visible = false;
        }

        // Validation Summary
        container = new ContentContainer();
        if (ValidationSummaryTemplate != null)
        {
            ValidationSummaryTemplate.InstantiateIn(container);
            uxValidationSummaryPlaceHolder.Controls.Add(container);
            uxValidationSummaryPanel.Visible = true;
        }
        else
        {
            uxValidationSummaryPlaceHolder.Controls.Add(new LiteralControl("No Validation Summary Defined"));
            uxValidationSummaryPanel.Visible = false;
        }

        // Validation Denotes
        container = new ContentContainer();
        if (ValidationDenotesTemplate != null)
        {
            ValidationDenotesTemplate.InstantiateIn(container);
            uxValidationDenotePlaceHolder.Controls.Add(container);
            uxValidationDenotePanel.Visible = true;
        }
        else
        {
            uxValidationDenotePlaceHolder.Controls.Add(new LiteralControl("No Validation Denotes Defined"));
            uxValidationDenotePanel.Visible = false;
        }

        // If all message disapear message panel will not show.
        if (!uxMessagePlaceHolder.Visible & !uxValidationSummaryPanel.Visible)
        {
            uxMessagePanel.Visible = false;
        }
        else
        {
            uxMessagePanel.Visible = true;
        }

        container = new ContentContainer();
        if (LanguageControlTemplate != null)
        {
            LanguageControlTemplate.InstantiateIn(container);
            uxLanguageControlPlaceHolder.Controls.Add(container);
            uxLanguageControlPanel.Visible = true;
        }
        else
        {
            uxLanguageControlPlaceHolder.Controls.Add(new LiteralControl("No Language Control Defined"));
            uxLanguageControlPanel.Visible = false;
        }

        // If don't have any language and message top panel will not show.
        if (!uxFilterPanel.Visible & !uxLanguageControlPanel.Visible & !uxSpecialFilterPanel.Visible)
        {
            uxTopPagePanel.Visible = false;
        }
        else
        {
            uxTopPagePanel.Visible = true;
        }


        if (ButtonEventTemplate == null)
        {
            uxButtonEventPanel.Visible = false;
        }
        else
        {
            container = new ContentContainer();
            ButtonEventTemplate.InstantiateIn(container);
            uxButtonEventPlaceHolder.Controls.Add(container);
            uxButtonEventPanel.Visible = true;
        }

        if (ButtonCommandTemplate == null)
        {
            uxButtonCommandPanel.Visible = false;
        }
        else
        {
            container = new ContentContainer();
            ButtonCommandTemplate.InstantiateIn(container);
            uxButtonCommandPlaceHolder.Controls.Add(container);
            uxButtonCommandPanel.Visible = true;
        }

        if (ButtonEventInnerBoxTemplate == null)
        {
            uxButtonEventInnerBoxPanel.Visible = false;
        }
        else
        {
            container = new ContentContainer();
            ButtonEventInnerBoxTemplate.InstantiateIn(container);
            uxButtonEventInnerBoxPlaceHolder.Controls.Add(container);
            uxButtonEventInnerBoxPanel.Visible = true;
        }

        container = new ContentContainer();
        if (TopContentBoxTemplate != null)
        {
            TopContentBoxTemplate.InstantiateIn(container);
            uxTopContentBoxPlaceHolder.Controls.Add(container);
            uxTopContentBoxPanel.Visible = true;
        }
        else
        {
            uxTopContentBoxPlaceHolder.Controls.Add(new LiteralControl("No TopContentBox Content Defined"));
            uxTopContentBoxPlaceHolder.Visible = false;
            uxTopContentBoxPanel.Visible       = false;
        }

        container = new ContentContainer();
        if (ContentTemplate != null)
        {
            ContentTemplate.InstantiateIn(container);
            uxContentPlaceHolder.Controls.Add(container);
            uxContentPanel.Visible = true;
        }
        else
        {
            uxContentPlaceHolder.Controls.Add(new LiteralControl("No Template Defined"));
            uxContentPanel.Visible = false;
        }

        container = new ContentContainer();
        if (PlainContentTemplate != null)
        {
            PlainContentTemplate.InstantiateIn(container);
            uxPlainContentPlaceHolder.Controls.Add(container);
            uxPlainContentPanel.Visible = true;
        }
        else
        {
            uxPlainContentPlaceHolder.Controls.Add(new LiteralControl("No Template Defined"));
            uxPlainContentPanel.Visible = false;
        }

        if (FilterTemplate == null)
        {
            uxFilterPanel.Visible = false;
        }
        else
        {
            container = new ContentContainer();
            FilterTemplate.InstantiateIn(container);
            uxFilterPlaceHolder.Controls.Add(container);
            uxFilterPanel.Visible = true;
        }

        if (SpecialFilterTemplate == null)
        {
            uxSpecialFilterPanel.Visible = false;
        }
        else
        {
            container = new ContentContainer();
            SpecialFilterTemplate.InstantiateIn(container);
            uxSpecialFilterPlaceHolder.Controls.Add(container);
            uxSpecialFilterPanel.Visible = true;
        }

        if (PageNumberTemplate == null)
        {
            uxPageNumberPanel.Visible = false;
        }
        else
        {
            container = new ContentContainer();
            PageNumberTemplate.InstantiateIn(container);
            uxPageNumberPlaceHolder.Controls.Add(container);
            uxPageNumberPanel.Visible = true;
        }

        if (GridTemplate == null)
        {
            uxGridPanel.Visible = false;
        }
        else
        {
            container = new ContentContainer();
            GridTemplate.InstantiateIn(container);
            uxGridPlaceHolder.Controls.Add(container);
            uxGridPanel.Visible = true;
        }

        if (uxGridPanel.Visible || uxPageNumberPanel.Visible || uxTopContentBoxPlaceHolder.Visible || uxButtonCommandPanel.Visible || uxButtonEventInnerBoxPanel.Visible)
        {
            uxTopContentBoxSet.Visible = true;
        }
        else
        {
            uxTopContentBoxSet.Visible = false;
        }

        if (BottomContentBoxTemplate == null)
        {
            uxBottomContentBoxPlaceHolder.Visible = false;
            uxBottomContentBoxPanel.Visible       = false;
        }
        else
        {
            container = new ContentContainer();
            BottomContentBoxTemplate.InstantiateIn(container);
            uxBottomContentBoxPlaceHolder.Controls.Add(container);
            uxBottomContentBoxPlaceHolder.Visible = true;
        }

        if (HeaderMessageTemplate != null)
        {
            HeaderMessageTemplate.InstantiateIn(container);
            uxHeaderMeassagePlaceHolder.Controls.Add(container);
            uxHeaderMeassagePanel.Visible = true;
        }
        else
        {
            uxHeaderMeassagePlaceHolder.Controls.Add(new LiteralControl("No Template Defined"));
            uxHeaderMeassagePanel.Visible = false;
        }
    }
예제 #19
0
        public void LoadPageControls()
        {
            this.CurrentWebPage.Header.Controls.Add(new Literal {
                Text = "\r\n"
            });

            List <HtmlMeta> lstMD = GetHtmlMeta(this.CurrentWebPage.Header);

            HtmlMeta metaGenerator = new HtmlMeta();

            metaGenerator.Name    = "generator";
            metaGenerator.Content = SiteData.CarrotCakeCMSVersion;
            this.CurrentWebPage.Header.Controls.Add(metaGenerator);
            this.CurrentWebPage.Header.Controls.Add(new Literal {
                Text = "\r\n"
            });

            if (guidContentID == SiteData.CurrentSiteID && SiteData.IsPageReal)
            {
                IsPageTemplate = true;
            }

            if (theSite != null && pageContents != null)
            {
                if (theSite.BlockIndex || pageContents.BlockIndex)
                {
                    bool     bCrawlExist = false;
                    HtmlMeta metaNoCrawl = new HtmlMeta();
                    metaNoCrawl.Name = "robots";

                    if (lstMD.Where(x => x.Name == "robots").Count() > 0)
                    {
                        metaNoCrawl = lstMD.Where(x => x.Name == "robots").FirstOrDefault();
                        bCrawlExist = true;
                    }

                    metaNoCrawl.Content = "noindex,nofollow,noarchive";

                    if (!bCrawlExist)
                    {
                        this.CurrentWebPage.Header.Controls.Add(metaNoCrawl);
                        this.CurrentWebPage.Header.Controls.Add(new Literal {
                            Text = "\r\n"
                        });
                    }
                }
            }

            InsertSpecialCtrl(this.CurrentWebPage.Header, ControlLocation.Header);

            if (pageContents != null)
            {
                HtmlMeta metaDesc   = new HtmlMeta();
                HtmlMeta metaKey    = new HtmlMeta();
                bool     bDescExist = false;
                bool     bKeyExist  = false;

                if (lstMD.Where(x => x.Name == "description").Count() > 0)
                {
                    metaDesc   = lstMD.Where(x => x.Name == "description").FirstOrDefault();
                    bDescExist = true;
                }
                if (lstMD.Where(x => x.Name == "keywords").Count() > 0)
                {
                    metaKey   = lstMD.Where(x => x.Name == "keywords").FirstOrDefault();
                    bKeyExist = true;
                }

                metaDesc.Name    = "description";
                metaKey.Name     = "keywords";
                metaDesc.Content = String.IsNullOrEmpty(pageContents.MetaDescription) ? theSite.MetaDescription : pageContents.MetaDescription;
                metaKey.Content  = String.IsNullOrEmpty(pageContents.MetaKeyword) ? theSite.MetaKeyword : pageContents.MetaKeyword;

                int indexPos = 6;
                if (this.CurrentWebPage.Header.Controls.Count > indexPos)
                {
                    if (!String.IsNullOrEmpty(metaDesc.Content) && !bDescExist)
                    {
                        this.CurrentWebPage.Header.Controls.AddAt(indexPos, new Literal {
                            Text = "\r\n"
                        });
                        this.CurrentWebPage.Header.Controls.AddAt(indexPos, metaDesc);
                    }
                    if (!String.IsNullOrEmpty(metaKey.Content) && !bKeyExist)
                    {
                        this.CurrentWebPage.Header.Controls.AddAt(indexPos, new Literal {
                            Text = "\r\n"
                        });
                        this.CurrentWebPage.Header.Controls.AddAt(indexPos, metaKey);
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(metaDesc.Content) && !bDescExist)
                    {
                        this.CurrentWebPage.Header.Controls.Add(metaDesc);
                        this.CurrentWebPage.Header.Controls.Add(new Literal {
                            Text = "\r\n"
                        });
                    }
                    if (!String.IsNullOrEmpty(metaKey.Content) && !bKeyExist)
                    {
                        this.CurrentWebPage.Header.Controls.Add(metaKey);
                        this.CurrentWebPage.Header.Controls.Add(new Literal {
                            Text = "\r\n"
                        });
                    }
                }

                metaDesc.Visible = !String.IsNullOrEmpty(metaDesc.Content);
                metaKey.Visible  = !String.IsNullOrEmpty(metaKey.Content);
            }

            contCenter = new ContentContainer();
            contLeft   = new ContentContainer();
            contRight  = new ContentContainer();

            if (pageContents != null)
            {
                using (ContentPageHelper pageHelper = new ContentPageHelper()) {
                    PageViewType pvt            = pageHelper.GetBlogHeadingFromURL(theSite, SiteData.CurrentScriptName);
                    string       sTitleAddendum = pvt.ExtraTitle;

                    if (!String.IsNullOrEmpty(sTitleAddendum))
                    {
                        if (!String.IsNullOrEmpty(pageContents.PageHead))
                        {
                            pageContents.PageHead = pageContents.PageHead.Trim() + ": " + sTitleAddendum;
                        }
                        else
                        {
                            pageContents.PageHead = sTitleAddendum;
                        }
                        pageContents.TitleBar = pageContents.TitleBar.Trim() + ": " + sTitleAddendum;
                    }

                    PagedDataSummary pd = (PagedDataSummary)cu.FindControl(typeof(PagedDataSummary), this.CurrentWebPage);

                    if (pd != null)
                    {
                        PagedDataSummaryTitleOption titleOpts = pd.TypeLabelPrefixes.Where(x => x.KeyValue == pvt.CurrentViewType).FirstOrDefault();

                        if (titleOpts == null &&
                            (pvt.CurrentViewType == PageViewType.ViewType.DateDayIndex ||
                             pvt.CurrentViewType == PageViewType.ViewType.DateMonthIndex ||
                             pvt.CurrentViewType == PageViewType.ViewType.DateYearIndex))
                        {
                            titleOpts = pd.TypeLabelPrefixes.Where(x => x.KeyValue == PageViewType.ViewType.DateIndex).FirstOrDefault();
                        }

                        if (titleOpts != null && !String.IsNullOrEmpty(titleOpts.FormatText))
                        {
                            pvt.ExtraTitle = string.Format(titleOpts.FormatText, pvt.RawValue);
                            sTitleAddendum = pvt.ExtraTitle;
                        }

                        if (titleOpts != null && !String.IsNullOrEmpty(titleOpts.LabelText))
                        {
                            pageContents.PageHead    = titleOpts.LabelText + " " + sTitleAddendum;
                            pageContents.NavMenuText = pageContents.PageHead;
                            pageContents.TitleBar    = pageContents.PageHead;
                        }
                    }
                }

                this.CurrentWebPage.Title = SetPageTitle(pageContents);

                DateTime dtModified = theSite.ConvertSiteTimeToLocalServer(pageContents.EditDate);
                string   strModifed = dtModified.ToString("r");
                HttpContext.Current.Response.AppendHeader("Last-Modified", strModifed);
                HttpContext.Current.Response.Cache.SetLastModified(dtModified);

                DateTime dtExpire = DateTime.Now.AddSeconds(15);

                contCenter.Text = pageContents.PageText;
                contLeft.Text   = pageContents.LeftPageText;
                contRight.Text  = pageContents.RightPageText;

                contCenter.DatabaseKey = pageContents.Root_ContentID;
                contLeft.DatabaseKey   = pageContents.Root_ContentID;
                contRight.DatabaseKey  = pageContents.Root_ContentID;

                pageContents = CMSConfigHelper.IdentifyLinkAsInactive(pageContents);

                if (SecurityData.IsAuthenticated)
                {
                    HttpContext.Current.Response.Cache.SetNoServerCaching();
                    HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    dtExpire = DateTime.Now.AddMinutes(-10);
                    HttpContext.Current.Response.Cache.SetExpires(dtExpire);

                    if (!SecurityData.AdvancedEditMode)
                    {
                        if (SecurityData.IsAdmin || SecurityData.IsSiteEditor)
                        {
                            if (!SiteData.IsPageSampler && !IsPageTemplate)
                            {
                                Control editor = this.CurrentWebPage.LoadControl(SiteFilename.EditNotifierControlPath);
                                this.CurrentWebPage.Form.Controls.Add(editor);
                            }
                        }
                    }
                    else
                    {
                        contCenter.IsAdminMode = true;
                        contLeft.IsAdminMode   = true;
                        contRight.IsAdminMode  = true;

                        contCenter.ZoneChar = "c";
                        contLeft.ZoneChar   = "l";
                        contRight.ZoneChar  = "r";

                        contCenter.TextZone = ContentContainer.TextFieldZone.TextCenter;
                        contLeft.TextZone   = ContentContainer.TextFieldZone.TextLeft;
                        contRight.TextZone  = ContentContainer.TextFieldZone.TextRight;

                        contCenter.Text = pageContents.PageText;
                        contLeft.Text   = pageContents.LeftPageText;
                        contRight.Text  = pageContents.RightPageText;

                        Control editor = this.CurrentWebPage.LoadControl(SiteFilename.AdvancedEditControlPath);
                        this.CurrentWebPage.Form.Controls.Add(editor);

                        MarkWidgets(this.CurrentWebPage, true);
                    }
                }
                else
                {
                    HttpContext.Current.Response.Cache.SetExpires(dtExpire);
                }

                InsertSpecialCtrl(this.CurrentWebPage.Form, ControlLocation.Footer);

                if (pageWidgets.Any())
                {
                    CMSConfigHelper cmsHelper = new CMSConfigHelper();

                    //find each placeholder in use ONCE!
                    List <LabeledControl> lstPlaceholders = (from ph in pageWidgets
                                                             where ph.Root_ContentID == pageContents.Root_ContentID
                                                             select new LabeledControl(ph.PlaceholderName, FindTheControl(ph.PlaceholderName, this.CurrentWebPage))).Distinct().ToList();

                    List <Widget> lstWidget = null;

                    if (SecurityData.AdvancedEditMode)
                    {
                        lstWidget = (from w in pageWidgets
                                     orderby w.WidgetOrder, w.EditDate
                                     where w.Root_ContentID == pageContents.Root_ContentID
                                     //&& w.IsWidgetActive == true
                                     && w.IsWidgetPendingDelete == false
                                     select w).ToList();
                    }
                    else
                    {
                        lstWidget = (from w in pageWidgets
                                     orderby w.WidgetOrder, w.EditDate
                                     where w.Root_ContentID == pageContents.Root_ContentID &&
                                     w.IsWidgetActive == true &&
                                     w.IsRetired == false && w.IsUnReleased == false &&
                                     w.IsWidgetPendingDelete == false
                                     select w).ToList();
                    }

                    foreach (Widget theWidget in lstWidget)
                    {
                        WidgetContainer plcHolder = (WidgetContainer)(from d in lstPlaceholders
                                                                      where d.ControlLabel == theWidget.PlaceholderName
                                                                      select d.KeyControl).FirstOrDefault();
                        if (plcHolder != null)
                        {
                            plcHolder.EnableViewState = true;
                            Control widget = new Control();

                            if (theWidget.ControlPath.EndsWith(".ascx"))
                            {
                                if (File.Exists(this.CurrentWebPage.Server.MapPath(theWidget.ControlPath)))
                                {
                                    try {
                                        widget = this.CurrentWebPage.LoadControl(theWidget.ControlPath);
                                    } catch (Exception ex) {
                                        Literal lit = new Literal();
                                        lit.Text = "<b>ERROR: " + theWidget.ControlPath + "</b> <br />\r\n" + ex.ToString();
                                        widget   = lit;
                                    }
                                }
                                else
                                {
                                    Literal lit = new Literal();
                                    lit.Text = "MISSING FILE: " + theWidget.ControlPath + "<br />\r\n";
                                    widget   = lit;
                                }
                            }

                            if (theWidget.ControlPath.ToLowerInvariant().StartsWith("class:"))
                            {
                                try {
                                    string className = theWidget.ControlPath.Replace("CLASS:", "");
                                    Type   t         = Type.GetType(className);
                                    Object o         = Activator.CreateInstance(t);

                                    if (o != null)
                                    {
                                        widget = o as Control;
                                    }
                                    else
                                    {
                                        Literal lit = new Literal();
                                        lit.Text = "OOPS: " + theWidget.ControlPath + "<br />\r\n";
                                        widget   = lit;
                                    }
                                } catch (Exception ex) {
                                    Literal lit = new Literal();
                                    lit.Text = "<b>ERROR: " + theWidget.ControlPath + "</b> <br />\r\n" + ex.ToString();
                                    widget   = lit;
                                }
                            }

                            widget.EnableViewState = true;

                            IWidget w = null;
                            if (widget is IWidget)
                            {
                                w               = widget as IWidget;
                                w.SiteID        = SiteData.CurrentSiteID;
                                w.PageWidgetID  = theWidget.Root_WidgetID;
                                w.RootContentID = theWidget.Root_ContentID;
                            }

                            if (widget is IWidgetParmData)
                            {
                                IWidgetParmData    wp      = widget as IWidgetParmData;
                                List <WidgetProps> lstProp = theWidget.ParseDefaultControlProperties();

                                wp.PublicParmValues = lstProp.ToDictionary(t => t.KeyName, t => t.KeyValue);
                            }

                            if (widget is IWidgetRawData)
                            {
                                IWidgetRawData wp = widget as IWidgetRawData;
                                wp.RawWidgetData = theWidget.ControlProperties;
                            }

                            if (widget is IWidgetEditStatus)
                            {
                                IWidgetEditStatus wes = widget as IWidgetEditStatus;
                                wes.IsBeingEdited = SecurityData.AdvancedEditMode;
                            }

                            Dictionary <string, string> lstMenus = new Dictionary <string, string>();
                            if (widget is IWidgetMultiMenu)
                            {
                                IWidgetMultiMenu wmm = widget as IWidgetMultiMenu;
                                lstMenus = wmm.JSEditFunctions;
                            }

                            if (SecurityData.AdvancedEditMode)
                            {
                                WidgetWrapper plcWrapper = plcHolder.AddWidget(widget, theWidget);

                                CMSPlugin plug = (from p in cmsHelper.ToolboxPlugins
                                                  where p.FilePath.ToLowerInvariant() == plcWrapper.ControlPath.ToLowerInvariant()
                                                  select p).FirstOrDefault();

                                if (plug != null)
                                {
                                    plcWrapper.ControlTitle = plug.Caption;
                                }
                                else
                                {
                                    plcWrapper.ControlTitle = "UNTITLED";
                                }

                                plcWrapper.ID = WrapCtrlId;

                                if (w != null)
                                {
                                    if (w.EnableEdit)
                                    {
                                        if (lstMenus.Count < 1)
                                        {
                                            string sScript = w.JSEditFunction;
                                            if (String.IsNullOrEmpty(sScript))
                                            {
                                                sScript = "cmsGenericEdit('" + pageContents.Root_ContentID + "','" + plcWrapper.DatabaseKey + "')";
                                            }

                                            plcWrapper.JSEditFunction = sScript;
                                        }
                                        else
                                        {
                                            plcWrapper.JSEditFunctions = lstMenus;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                plcHolder.AddWidget(widget);
                            }

                            widget.ID = CtrlId;
                        }
                    }

                    cmsHelper.Dispose();
                }
            }
        }
예제 #20
0
        public GuiPlayerInventoryDialog(Player player, Inventory inventory)
        {
            Player    = player;
            Inventory = inventory;

            // Subscribe to events

            _guiHotBarInventoryItems = new InventoryContainerItem[inventory?.SlotCount ?? 0];

            if (_guiHotBarInventoryItems.Length != 46)
            {
                throw new ArgumentOutOfRangeException(nameof(inventory), inventory?.SlotCount ?? 0, "Expected player inventory containing 46 slots.");
            }

            ContentContainer.Background        = GuiTextures.InventoryPlayerBackground;
            ContentContainer.BackgroundOverlay = null;

            ContentContainer.Width  = ContentContainer.MinWidth = ContentContainer.MaxWidth = 176;
            ContentContainer.Height = ContentContainer.MinHeight = ContentContainer.MaxHeight = 166;

            SetFixedSize(176, 166);

            ContentContainer.AutoSizeMode = AutoSizeMode.None;

            var modelRenderer = player.ModelRenderer;
            var mob           = new PlayerMob(player.Name, player.Level, player.Network,
                                              player.ModelRenderer.Texture)
            {
                ModelRenderer = modelRenderer,
            };

            ContentContainer.AddChild(_playerEntityModelView =
                                          new GuiEntityModelView(mob)
            {
                Margin            = new Thickness(7, 25),
                Width             = 49,
                Height            = 70,
                Anchor            = Alignment.TopLeft,
                AutoSizeMode      = AutoSizeMode.None,
                Background        = null,
                BackgroundOverlay = null
            });

            Color color = Color.Blue;

            foreach (var slot in AddSlots(8, 84, 9, 27, 9, 0x00))
            {
                //   slot.HighlightedBackground = new Microsoft.Xna.Framework.Color(color, 0.5f);
                slot.Item = Inventory[slot.InventoryIndex];
            }

            color = Color.Aqua;
            foreach (var slot in AddSlots(8, 142, 9, 9, 0, 0))
            {
                // slot.HighlightedBackground = new Microsoft.Xna.Framework.Color(color, 0.5f);
                slot.Item = Inventory[slot.InventoryIndex];
            }

            foreach (var slot in AddSlots(8, 8, 1, 4, 0, 120))
            {
                var  inventoryIndex = slot.InventoryIndex;
                Item item           = new ItemAir();

                switch (slot.InventoryIndex)
                {
                case 0:
                    item           = Inventory.Helmet;
                    inventoryIndex = Inventory.HelmetSlot;
                    break;

                case 1:
                    item           = Inventory.Chestplate;
                    inventoryIndex = Inventory.ChestSlot;
                    break;

                case 2:
                    item           = Inventory.Leggings;
                    inventoryIndex = Inventory.LeggingsSlot;
                    break;

                case 3:
                    item           = Inventory.Boots;
                    inventoryIndex = Inventory.BootsSlot;
                    break;
                }

                //  slot.HighlightedBackground = new Microsoft.Xna.Framework.Color(Color.Red, 0.5f);
                slot.Item           = item;
                slot.InventoryIndex = inventoryIndex;
            }

            foreach (var slot in AddSlots(98, 18, 2, 4, 41, 0))
            {
                slot.Item = Inventory[slot.InventoryIndex];
                //  slot.HighlightedBackground = new Microsoft.Xna.Framework.Color(Color.Purple, 0.5f);
            }

            CraftingOutput = AddSlot(154, 28, 45, 0);
            //  CraftingOutput.HighlightedBackground = new Microsoft.Xna.Framework.Color(Color.Purple, 0.5f);

            /*var shieldSlot = new InventoryContainerItem()
             * {
             *  HighlightedBackground = new Microsoft.Xna.Framework.Color(Color.Orange, 0.5f),
             *  Anchor = Alignment.TopLeft,
             *  Margin =  new Thickness(61, 76),
             *  AutoSizeMode = AutoSizeMode.None,
             *  Item = Inventory[40],
             *  InventoryIndex = 40
             * };
             *
             * ContentContainer.AddChild(shieldSlot);*/
        }
예제 #21
0
 internal TableElementContentContainer(Table table, PropertyRecord []localValues, ContentContainer childContainer) :
     base(table.GetType(), localValues, table.Resources, childContainer)
 {
     _cpTable = table.TextContainer.Start.GetOffsetToPosition(table.ContentStart);
     _columns = SaveColumns(table);
 }
예제 #22
0
        // Copies a TextElement and all its contained content into a ContentContainer.
        // Returns the next node to examine.
        private TextTreeNode CopyElementNode(TextTreeTextElementNode elementNode, out ContentContainer container)
        {
            if(elementNode.TextElement is Table)
            {
                container = new TableElementContentContainer(elementNode.TextElement as Table,
                                                        GetPropertyRecordArray(elementNode.TextElement),
                                                        CopyContent((TextTreeNode)elementNode.GetFirstContainedNode(), null));

            }
            else
            {
                container = new ElementContentContainer(elementNode.TextElement.GetType(),
                                                        GetPropertyRecordArray(elementNode.TextElement),
                                                        elementNode.TextElement.Resources,
                                                        CopyContent((TextTreeNode)elementNode.GetFirstContainedNode(), null));
            }

            return (TextTreeNode)elementNode.GetNextNode();
        }
예제 #23
0
        // Copies a run of text into a ContentContainer.
        // Returns the next node to examine.
        private TextTreeNode CopyTextNode(TextTreeTextNode textNode, TextTreeNode haltNode, out ContentContainer container)
        {
            SplayTreeNode node;
            char[] text;
            int count;
            int symbolOffset;

            Invariant.Assert(textNode != haltNode, "Expect at least one node to copy!");

            symbolOffset = textNode.GetSymbolOffset(this.TextContainer.Generation);

            // Get a count of all the characters we're about to copy.
            count = 0;
            node = textNode;

            do
            {
                count += textNode.SymbolCount;

                node = textNode.GetNextNode();
                textNode = node as TextTreeTextNode;
            }
            while (textNode != null && textNode != haltNode);

            // Allocate storage.
            text = new char[count];

            // Copy the text.
            TextTreeText.ReadText(this.TextContainer.RootTextBlock, symbolOffset, count, text, 0 /*startIndex*/);

            container = new TextContentContainer(text);

            return (TextTreeNode)node;
        }
 // Creates a new instance.
 // childContainer holds all content covered by this TextElement.
 internal ElementContentContainer(Type elementType, PropertyRecord[] localValues, ResourceDictionary resources, ContentContainer childContainer)
 {
     _elementType    = elementType;
     _localValues    = localValues;
     _childContainer = childContainer;
     _resources      = resources;
 }
예제 #25
0
 public void LoadAudioEffect(string Location, ContentContainer container)
 {
     m_SoundEffect = ContentLoader.Instance.Load<SoundEffect>(container, Location);
     m_SoundEffectInstance = m_SoundEffect.CreateInstance();
 }
 internal TableElementContentContainer(Table table, PropertyRecord [] localValues, ContentContainer childContainer) :
     base(table.GetType(), localValues, table.Resources, childContainer)
 {
     _cpTable = table.TextContainer.Start.GetOffsetToPosition(table.ContentStart);
     _columns = SaveColumns(table);
 }
예제 #27
0
 public override void LoadContent()
 {
     clearEffect = ContentContainer.Instance().GetEffect("Engine\\Shaders\\ClearEffect");
     base.LoadContent();
 }
예제 #28
0
        private TextTreeNode CopyObjectNode(TextTreeObjectNode objectNode, out ContentContainer container)
        {
            // XamlWriter.Save demands unmanaged code permission. Since it's not safe to assert 
            // here as custom type converters and value serializers can potentially execute 
            // arbitrary code, we block the call to XamlWriter.Save in partial trust.
            if (SecurityHelper.CheckUnmanagedCodePermission())
            {
                string xml;

                xml = XamlWriter.Save(objectNode.EmbeddedElement);

                container = new ObjectContentContainer(xml, objectNode.EmbeddedElement);
            }
            else
            {
                container = new ObjectContentContainer(null, null);
            }

            return (TextTreeNode)objectNode.GetNextNode();
        }
예제 #29
0
        /// <summary>
        /// </summary>
        /// <param name="userId"></param>
        public void PurgeUserMessagesBroken(int userId)
        {
            lock (DrawableChatMessages)
                lock (ContentContainer.Animations)
                {
                    for (var i = DrawableChatMessages.Count - 1; i >= 0; i--)
                    {
                        var msg = DrawableChatMessages[i];

                        if (msg.Message.Sender.OnlineUser.Id != userId)
                        {
                            continue;
                        }

                        RemoveContainedDrawable(msg);
                        DrawableChatMessages.Remove(msg);

                        TotalMessageHeight -= msg.Height;
                        PoolStartingIndex--;

                        if (PoolStartingIndex <= 0)
                        {
                            PoolStartingIndex = 0;
                        }
                    }

                    for (var i = 0; i < DrawableChatMessages.Count; i++)
                    {
                        var msg = DrawableChatMessages[i];

                        if (i == 0)
                        {
                            msg.Y = 0;
                            continue;
                        }

                        msg.Y = DrawableChatMessages[i - 1].Y + DrawableChatMessages[i - 1].Height;
                    }

                    if (TotalMessageHeight > Overlay.MessageContainer.Height - Overlay.CurrentTopicContainer.Height)
                    {
                        ContentContainer.Height = TotalMessageHeight;
                    }
                    else
                    {
                        ContentContainer.Height = Overlay.MessageContainer.Height - Overlay.CurrentTopicContainer.Height;
                    }

                    ContentContainer.ClearAnimations();
                    ContentContainer.Y        = -ContentContainer.Height;
                    PreviousContentContainerY = -ContentContainer.Height;
                    TargetY         = -ContentContainer.Height;
                    PreviousTargetY = -ContentContainer.Height;

                    for (var i = 0; i < DrawableChatMessages.Count; i++)
                    {
                        if (i >= DrawableChatMessages.Count)
                        {
                            break;
                        }

                        var msg = DrawableChatMessages[i];

                        if (i >= PoolStartingIndex)
                        {
                            if (msg.Parent != ContentContainer)
                            {
                                AddContainedDrawable(msg);
                            }
                        }
                        else
                        {
                            if (msg.Parent == ContentContainer)
                            {
                                RemoveContainedDrawable(msg);
                            }
                        }
                    }
                }
        }
예제 #30
0
 // Creates a new instance.
 // childContainer holds all content covered by this TextElement.
 internal ElementContentContainer(Type elementType, PropertyRecord[] localValues, ResourceDictionary resources, ContentContainer childContainer)
 {
     _elementType = elementType;
     _localValues = localValues;
     _childContainer = childContainer;
     _resources = resources;
 }
        public IRuleBuilder <TContentType, TConditionType> WithContentContainer(ContentContainer <TContentType> contentContainer)
        {
            this.contentContainer = contentContainer;

            return(this);
        }
예제 #32
0
 private void load()
 {
     ContentContainer.Add(keyBindingPanel);
 }
예제 #33
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            ContentContainer.LoadContent(Content);

            gameEffect = Content.Load <Effect>("Effect\\effect");
            tex        = Content.Load <Texture2D>("character");
            font       = Content.Load <SpriteFont>("File");

            Map = new Map(Content, GraphicsDevice);


            SetUpVertices();
            player = new Player(Vector2.Zero);
            Engine.GameUtility.Physic.Point circle = new Engine.GameUtility.Physic.Point(new Vector2(positionOnPlane.X, positionOnPlane.Z));
            player.CollisionObject              = circle;
            player.CollisionObject.OnCollision += new CollideDetected(delegate(ICollider item)
            {
                if (item.GetType() == typeof(Polygon))
                {
                    MessageBox.Show("Collide", "Circle<>Linse", new string[] { "walsiw" });
                }
            });

            player.CollisionObject.OnCollision += new CollideDetected(EventMethod);
            Director.InstanceDirector.Camera.SetDevice(GraphicsDevice);

            model = Content.Load <Model>("robot");

            StreamReader MapWriter = new StreamReader("pasta\\Map0.json");
            Map          objectMap = JsonConvert.DeserializeObject <Map>(MapWriter.ReadToEnd(),
                                                                         new JsonSerializerSettings()
            {
                TypeNameHandling = TypeNameHandling.Objects
            });

            MapWriter.Close();
            Map = objectMap;
            Map.InitTestGame(player);


            BiStableKey key = new BiStableKey(Keys.Up);

            key.action += new ClickTrigger(delegate
            {
                foreach (PlayerClass otherPl in OtherPlayerList)
                {
                    otherPl.interstepAdd += 0.01f;
                }
            });
            keys.Add(key);

            BiStableKey key2 = new BiStableKey(Keys.Down);

            key2.action += new ClickTrigger(delegate
            {
                foreach (PlayerClass otherPl in OtherPlayerList)
                {
                    otherPl.interstepAdd -= 0.01f;
                }
            });
            keys.Add(key2);


            BiStableKey key3 = new BiStableKey(Keys.Right);

            key3.action += new ClickTrigger(delegate
            {
                movePacketInterval += 10;
            });
            keys.Add(key3);

            BiStableKey key4 = new BiStableKey(Keys.Left);

            key4.action += new ClickTrigger(delegate
            {
                foreach (PlayerClass otherPl in OtherPlayerList)
                {
                    movePacketInterval -= 10;
                }
            });
            keys.Add(key4);
            // MapWriter.Write(jsonSerialize);
        }
예제 #34
0
    public void ChangeArticle(string id, bool playClickSound = false)
    {
        Debug.Assert(id != null);
        if (playClickSound)
        {
            KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false));
        }
        if (contentContainerPool == null)
        {
            Init();
        }
        SubEntry subEntry = null;

        if (!CodexCache.entries.ContainsKey(id))
        {
            subEntry = null;
            subEntry = CodexCache.FindSubEntry(id);
            if (subEntry != null && !subEntry.disabled)
            {
                id = subEntry.parentEntryID.ToUpper();
            }
        }
        ICodexWidget codexWidget = null;

        CodexCache.entries[id].GetFirstWidget();
        RectTransform rectTransform = null;

        if (subEntry != null)
        {
            foreach (ContentContainer contentContainer2 in CodexCache.entries[id].contentContainers)
            {
                if (contentContainer2 == subEntry.contentContainers[0])
                {
                    codexWidget = contentContainer2.content[0];
                    break;
                }
            }
        }
        if (!CodexCache.entries.ContainsKey(id) || CodexCache.entries[id].disabled)
        {
            id = "PAGENOTFOUND";
        }
        int    num  = 0;
        string text = string.Empty;

        while (contentContainers.transform.childCount > 0)
        {
            while (!string.IsNullOrEmpty(text) && CodexCache.entries[activeEntryID].contentContainers[num].lockID == text)
            {
                num++;
            }
            GameObject gameObject = contentContainers.transform.GetChild(0).gameObject;
            int        num2       = 0;
            while (gameObject.transform.childCount > 0)
            {
                GameObject gameObject2 = gameObject.transform.GetChild(0).gameObject;
                Type       key;
                if (gameObject2.name == "PrefabContentLocked")
                {
                    text = CodexCache.entries[activeEntryID].contentContainers[num].lockID;
                    key  = typeof(CodexContentLockedIndicator);
                }
                else
                {
                    key = CodexCache.entries[activeEntryID].contentContainers[num].content[num2].GetType();
                }
                ContentUIPools[key].ClearElement(gameObject2);
                num2++;
            }
            contentContainerPool.ClearElement(contentContainers.transform.GetChild(0).gameObject);
            num++;
        }
        bool flag = CodexCache.entries[id] is CategoryEntry;

        activeEntryID = id;
        if (CodexCache.entries[id].contentContainers == null)
        {
            CodexCache.entries[id].contentContainers = new List <ContentContainer>();
        }
        bool   flag2 = false;
        string a     = string.Empty;

        for (int i = 0; i < CodexCache.entries[id].contentContainers.Count; i++)
        {
            ContentContainer contentContainer = CodexCache.entries[id].contentContainers[i];
            if (!string.IsNullOrEmpty(contentContainer.lockID) && !Game.Instance.unlocks.IsUnlocked(contentContainer.lockID))
            {
                if (a != contentContainer.lockID)
                {
                    GameObject gameObject3 = contentContainerPool.GetFreeElement(contentContainers.gameObject, true).gameObject;
                    ConfigureContentContainer(contentContainer, gameObject3, flag && flag2);
                    a = contentContainer.lockID;
                    GameObject gameObject4 = ContentUIPools[typeof(CodexContentLockedIndicator)].GetFreeElement(gameObject3, true).gameObject;
                }
            }
            else
            {
                GameObject gameObject3 = contentContainerPool.GetFreeElement(contentContainers.gameObject, true).gameObject;
                ConfigureContentContainer(contentContainer, gameObject3, flag && flag2);
                flag2 = !flag2;
                if (contentContainer.content != null)
                {
                    foreach (ICodexWidget item in contentContainer.content)
                    {
                        GameObject gameObject5 = ContentUIPools[item.GetType()].GetFreeElement(gameObject3, true).gameObject;
                        item.Configure(gameObject5, displayPane, textStyles);
                        if (item == codexWidget)
                        {
                            rectTransform = gameObject5.rectTransform();
                        }
                    }
                }
            }
        }
        string text2 = string.Empty;
        string text3 = id;
        int    num3  = 0;

        while (text3 != CodexCache.FormatLinkID("HOME") && num3 < 10)
        {
            num3++;
            if (text3 != null)
            {
                text2 = ((!(text3 != id)) ? text2.Insert(0, CodexCache.entries[text3].name) : text2.Insert(0, CodexCache.entries[text3].name + " > "));
                text3 = CodexCache.entries[text3].parentId;
            }
            else
            {
                text3 = CodexCache.entries[CodexCache.FormatLinkID("HOME")].id;
                text2 = text2.Insert(0, CodexCache.entries[text3].name + " > ");
            }
        }
        currentLocationText.text = ((!(text2 == string.Empty)) ? text2 : CodexCache.entries["HOME"].name);
        if (history.Count == 0)
        {
            history.Add(activeEntryID);
        }
        else if (history[history.Count - 1] != activeEntryID)
        {
            if (history.Count > 1 && history[history.Count - 2] == activeEntryID)
            {
                history.RemoveAt(history.Count - 1);
            }
            else
            {
                history.Add(activeEntryID);
            }
        }
        if (history.Count > 1)
        {
            backButton.text = UI.FormatAsLink(string.Format(UI.CODEX.BACK_BUTTON, UI.StripLinkFormatting(CodexCache.entries[history[history.Count - 2]].name)), CodexCache.entries[history[history.Count - 2]].id);
        }
        else
        {
            backButton.text = UI.StripLinkFormatting(GameUtil.ColourizeString(Color.grey, string.Format(UI.CODEX.BACK_BUTTON, CodexCache.entries["HOME"].name)));
        }
        if ((UnityEngine.Object)rectTransform != (UnityEngine.Object)null)
        {
            if (scrollToTargetRoutine != null)
            {
                StopCoroutine(scrollToTargetRoutine);
            }
            scrollToTargetRoutine = StartCoroutine(ScrollToTarget(rectTransform));
        }
        else
        {
            displayScrollRect.content.SetLocalPosition(Vector3.zero);
        }
    }
예제 #35
0
 protected override void AnimateOpen()
 {
     ContentContainer.Show();
 }
예제 #36
0
        protected virtual void ParseConfigurationFile()
        {
            string currentStatus = "";
            string nameBlock     = "";

            using (var sr = new StreamReader(new FileStream("Content\\Data.ascension", FileMode.Open)))
            {
                var    cc = ContentContainer.Instance();
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    if (line.StartsWith("["))
                    {
                        currentStatus = "ParseNameBlock";
                    }

                    switch (currentStatus)
                    {
                    case "ParseNameBlock":
                        StringBuilder sb = new StringBuilder();
                        for (int i = 1; i < line.Length - 1; i++)
                        {
                            if (!char.IsLetter(line[i]))
                            {
                                throw new Exception("Can't parse config file");
                            }
                            sb.Append(line[i]);
                        }
                        nameBlock     = sb.ToString();
                        currentStatus = "ParseBlock";
                        break;

                    case "ParseBlock":
                        switch (nameBlock)
                        {
                        case "Scenes":

                            if (line.StartsWith("ActiveScene"))
                            {
                                SetActiveScene(cc.GetScene(line.Split('|')[1]));
                            }
                            else
                            {
                                Scene scene = Scene.Load(line, renderSystem);
                                scene.Initialize();
                                scene.LoadContent();
                                cc.AddUserContent(scene);
                            }
                            break;

                        case "Effects":
                            cc.AddContent <Effect>(Content.Load <Effect>(line));
                            break;

                        case "Textures":
                            cc.AddContent <Texture2D>(Content.Load <Texture2D>(line));
                            break;

                        case "MaterialsData":
                            cc.LoadMaterials(line);
                            break;

                        case "Models":
                            var tempArr = line.Split('|');
                            cc.AddUserContent <ModelInstance>(new ModelInstance(tempArr[0], Content.Load <Model>(tempArr[1])));
                            break;
                        }
                        break;
                    }
                }
            }
        }
예제 #37
0
 protected override void AnimateClose()
 {
     ContentContainer.Hide();
 }
예제 #38
0
 public override void Add(View view)
 {
     ContentContainer.Add(view);
 }
예제 #39
0
 public void LoadSong(string Location, ContentContainer container)
 {
     m_Song = ContentLoader.Instance.Load<Song>(container, Location);
 }