Exemplo n.º 1
0
        public TextBehavior(TextCard card)
        {
            this.Value        = "default text";
            this.BufferedSize = new SizeBehavior();
            this.Padding      = new Vector2f(6.0f, 3.0f);

            this.Card = card;
        }
Exemplo n.º 2
0
        public Page Get(int id)
        {
            var page = new Page
            {
                Id          = id,
                Title       = "Новая страница",
                Description = "Описание новой страницы"
            };
            var text1 = new TextCard
            {
                Id       = 1,
                Text     = new Text("Текст номер один"),
                TextType = TextType.Header1
            };
            var text2 = new TextCard
            {
                Id       = 2,
                Text     = new Text("Новый абзац текста без переноса строки aasdasd asdasd"),
                TextType = TextType.Paragraph
            };

            text2.Text.AddEntity(EntityType.Bold, 0, 11);
            text2.Text.AddEntity(EntityType.Italic, 11, 8);
            text2.Text.AddEntity(EntityType.Strikethrough, 13, 5);
            text2.Text.AddEntity(EntityType.Underline, 18, 7);
            var listText = new Text("очередной пункт списка");

            listText.AddEntity(EntityType.Bold, 0, 11);
            listText.AddEntity(EntityType.Italic, 11, 8);
            var list1 = new ListCard
            {
                Id    = 3,
                Items = new List <Text> {
                    listText, listText, listText, listText
                },
                ListType = ListType.BulletedList
            };
            var list2 = new ListCard
            {
                Id    = 3,
                Items = new List <Text> {
                    listText, listText
                },
                ListType = ListType.OrderedList
            };

            page.Cards.Add(text1);
            page.Cards.Add(text2);
            page.Cards.Add(list1);
            page.Cards.Add(list2);
            return(page);
        }
Exemplo n.º 3
0
        public override void Unload()
        {
            if (!Main.dedServ)
            {
                RiftRecipes = null;

                StaminaUserInterface    = null;
                CollectionUserInterface = null;
                OverlayUserInterface    = null;
                InfusionUserInterface   = null;
                CookingUserInterface    = null;
                TextCardUserInterface   = null;
                CodexUserInterface      = null;
                CodexPopupUserInterface = null;
                LootUserInterface       = null;
                ChatboxUserInterface    = null;
                ExtraNPCInterface       = null;

                stamina       = null;
                collection    = null;
                overlay       = null;
                infusion      = null;
                cooking       = null;
                textcard      = null;
                codex         = null;
                codexpopup    = null;
                lootUI        = null;
                Chatbox       = null;
                ExtraNPCState = null;

                Instance  = null;
                Dash      = null;
                Superdash = null;
                Wisp      = null;
                Smash     = null;
                Purify    = null;
            }

            UnhookIL();
            Main.OnPreDraw -= TestLighting;
        }
Exemplo n.º 4
0
        public override void Load()
        {
            //Shaders
            if (!Main.dedServ)
            {
                GameShaders.Misc["StarlightRiver:Distort"] = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/Distort")), "Distort");

                Ref <Effect> screenRef4 = new Ref <Effect>(GetEffect("Effects/Shockwave"));
                Filters.Scene["ShockwaveFilter"] = new Filter(new ScreenShaderData(screenRef4, "ShockwavePass"), EffectPriority.VeryHigh);
                Filters.Scene["ShockwaveFilter"].Load();

                Ref <Effect> screenRef3 = new Ref <Effect>(GetEffect("Effects/WaterEffect"));
                Filters.Scene["WaterFilter"] = new Filter(new ScreenShaderData(screenRef3, "WaterPass"), EffectPriority.VeryHigh);
                Filters.Scene["WaterFilter"].Load();

                Ref <Effect> screenRef2 = new Ref <Effect>(GetEffect("Effects/AuraEffect"));
                Filters.Scene["AuraFilter"] = new Filter(new ScreenShaderData(screenRef2, "AuraPass"), EffectPriority.VeryHigh);
                Filters.Scene["AuraFilter"].Load();

                Ref <Effect> screenRef = new Ref <Effect>(GetEffect("Effects/BlurEffect"));
                Filters.Scene["BlurFilter"] = new Filter(new ScreenShaderData(screenRef, "BlurPass"), EffectPriority.High);
                Filters.Scene["BlurFilter"].Load();

                Ref <Effect> screenRef5 = new Ref <Effect>(GetEffect("Effects/Purity"));
                Filters.Scene["PurityFilter"] = new Filter(new ScreenShaderData(screenRef5, "PurityPass"), EffectPriority.High);
                Filters.Scene["PurityFilter"].Load();

                Ref <Effect> screenRef6 = new Ref <Effect>(GetEffect("Effects/LightShader"));
                Filters.Scene["Lighting"] = new Filter(new ScreenShaderData(screenRef6, "LightingPass"), EffectPriority.High);
                Filters.Scene["Lighting"].Load();

                Ref <Effect> screenRef7 = new Ref <Effect>(GetEffect("Effects/LightApply"));
                Filters.Scene["LightingApply"] = new Filter(new ScreenShaderData(screenRef7, "LightingApplyPass"), EffectPriority.High);
                Filters.Scene["LightingApply"].Load();

                Ref <Effect> screenRef8 = new Ref <Effect>(GetEffect("Effects/pixelationFull"));
                Filters.Scene["Pixelation"] = new Filter(new ScreenShaderData(screenRef8, "PixelationPass"), EffectPriority.Medium);
                Filters.Scene["Pixelation"].Load();

                Ref <Effect> screenRefCrystal = new Ref <Effect>(GetEffect("Effects/CrystalRefraction"));
                Filters.Scene["Crystal"] = new Filter(new ScreenShaderData(screenRefCrystal, "CrystalPass"), EffectPriority.High);
                Filters.Scene["Crystal"].Load();

                Ref <Effect> screenRefIceCrystal = new Ref <Effect>(GetEffect("Effects/IceCrystal"));
                Filters.Scene["IceCrystal"] = new Filter(new ScreenShaderData(screenRefIceCrystal, "IcePass"), EffectPriority.High);
                Filters.Scene["IceCrystal"].Load();

                Ref <Effect> screenRefWaves = new Ref <Effect>(GetEffect("Effects/Waves"));
                Filters.Scene["Waves"] = new Filter(new ScreenShaderData(screenRefWaves, "WavesPass"), EffectPriority.High);
                Filters.Scene["Waves"].Load();

                Ref <Effect> screenRefWaterShine = new Ref <Effect>(GetEffect("Effects/WaterShine"));
                Filters.Scene["WaterShine"] = new Filter(new ScreenShaderData(screenRefWaterShine, "WaterShinePass"), EffectPriority.High);
                Filters.Scene["WaterShine"].Load();

                lightingTest = new RenderTest();
            }

            //Autoload Rift Recipes
            RiftRecipes = new List <RiftRecipe>();
            AutoloadRiftRecipes(RiftRecipes);

            //Furniture
            AutoloadFurniture();

            //UI
            if (!Main.dedServ)
            {
                //Hotkeys
                AbilityKeys = new AbilityHotkeys(this);
                AbilityKeys.LoadDefaults();

                StaminaUserInterface      = new UserInterface();
                CollectionUserInterface   = new UserInterface();
                OverlayUserInterface      = new UserInterface();
                InfusionUserInterface     = new UserInterface();
                CookingUserInterface      = new UserInterface();
                KeyInventoryUserInterface = new UserInterface();
                TextCardUserInterface     = new UserInterface();
                CodexUserInterface        = new UserInterface();
                CodexPopupUserInterface   = new UserInterface();
                LootUserInterface         = new UserInterface();
                ChatboxUserInterface      = new UserInterface();
                ExtraNPCInterface         = new UserInterface();
                RichTextInterface         = new UserInterface();

                stamina      = new Stamina();
                collection   = new Collection();
                overlay      = new ParticleOverlay();
                infusion     = new Infusion();
                cooking      = new CookingUI();
                keyinventory = new KeyInventory();
                textcard     = new TextCard();
                codex        = new GUI.Codex();
                codexpopup   = new CodexPopup();
                lootUI       = new LootUI();
                Chatbox      = new ChatboxOverUI();
                RichText     = new RichTextBox();

                StaminaUserInterface.SetState(stamina);
                CollectionUserInterface.SetState(collection);
                OverlayUserInterface.SetState(overlay);
                InfusionUserInterface.SetState(infusion);
                CookingUserInterface.SetState(cooking);
                KeyInventoryUserInterface.SetState(keyinventory);
                TextCardUserInterface.SetState(textcard);
                CodexUserInterface.SetState(codex);
                CodexPopupUserInterface.SetState(codexpopup);
                LootUserInterface.SetState(lootUI);
                ChatboxUserInterface.SetState(Chatbox);
                RichTextInterface.SetState(RichText);
            }

            //particle systems
            if (!Main.dedServ)
            {
                LoadVitricBGSystems();
            }

            //Hooking
            HookOn();
            HookIL();
        }
Exemplo n.º 5
0
        public override void Load()
        {
            //Shaders
            if (!Main.dedServ)
            {
                GameShaders.Misc["StarlightRiver:Distort"] = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/Distort")), "Distort");

                Ref <Effect> screenRef4 = new Ref <Effect>(GetEffect("Effects/Shockwave"));
                Terraria.Graphics.Effects.Filters.Scene["ShockwaveFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef4, "ShockwavePass"), Terraria.Graphics.Effects.EffectPriority.VeryHigh);
                Terraria.Graphics.Effects.Filters.Scene["ShockwaveFilter"].Load();

                Ref <Effect> screenRef3 = new Ref <Effect>(GetEffect("Effects/WaterEffect"));
                Terraria.Graphics.Effects.Filters.Scene["WaterFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef3, "WaterPass"), Terraria.Graphics.Effects.EffectPriority.VeryHigh);
                Terraria.Graphics.Effects.Filters.Scene["WaterFilter"].Load();

                Ref <Effect> screenRef2 = new Ref <Effect>(GetEffect("Effects/AuraEffect"));
                Terraria.Graphics.Effects.Filters.Scene["AuraFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef2, "AuraPass"), Terraria.Graphics.Effects.EffectPriority.VeryHigh);
                Terraria.Graphics.Effects.Filters.Scene["AuraFilter"].Load();

                Ref <Effect> screenRef = new Ref <Effect>(GetEffect("Effects/BlurEffect"));
                Terraria.Graphics.Effects.Filters.Scene["BlurFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef, "BlurPass"), Terraria.Graphics.Effects.EffectPriority.High);
                Terraria.Graphics.Effects.Filters.Scene["BlurFilter"].Load();

                Ref <Effect> screenRef5 = new Ref <Effect>(GetEffect("Effects/Purity"));
                Terraria.Graphics.Effects.Filters.Scene["PurityFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef5, "PurityPass"), Terraria.Graphics.Effects.EffectPriority.High);
                Terraria.Graphics.Effects.Filters.Scene["PurityFilter"].Load();

                Ref <Effect> screenRef6 = new Ref <Effect>(GetEffect("Effects/LightShader"));
                Terraria.Graphics.Effects.Filters.Scene["Lighting"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef6, "LightingPass"), Terraria.Graphics.Effects.EffectPriority.High);
                Terraria.Graphics.Effects.Filters.Scene["Lighting"].Load();

                Ref <Effect> screenRef7 = new Ref <Effect>(GetEffect("Effects/LightApplicator"));
                Terraria.Graphics.Effects.Filters.Scene["LightingApply"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef7, "LightingApplyPass"), Terraria.Graphics.Effects.EffectPriority.High);
                Terraria.Graphics.Effects.Filters.Scene["LightingApply"].Load();
            }

            //Autoload Rift Recipes
            RiftRecipes = new List <RiftRecipe>();
            AutoloadRiftRecipes(RiftRecipes);

            //Hotkeys
            Dash      = RegisterHotKey("Forbidden Winds", "LeftShift");
            Wisp      = RegisterHotKey("Faeflame", "F");
            Purify    = RegisterHotKey("[PH]Purify Crown", "N");
            Smash     = RegisterHotKey("Gaia's Fist", "Z");
            Superdash = RegisterHotKey("Zzelera's Cloak", "Q");

            //UI
            if (!Main.dedServ)
            {
                StaminaUserInterface      = new UserInterface();
                CollectionUserInterface   = new UserInterface();
                OverlayUserInterface      = new UserInterface();
                InfusionUserInterface     = new UserInterface();
                CookingUserInterface      = new UserInterface();
                KeyInventoryUserInterface = new UserInterface();
                TextCardUserInterface     = new UserInterface();
                CodexUserInterface        = new UserInterface();
                CodexPopupUserInterface   = new UserInterface();
                LootUserInterface         = new UserInterface();
                ChatboxUserInterface      = new UserInterface();
                ExtraNPCInterface         = new UserInterface();

                stamina      = new Stamina();
                collection   = new Collection();
                overlay      = new Overlay();
                infusion     = new Infusion();
                cooking      = new Cooking();
                keyinventory = new KeyInventory();
                textcard     = new TextCard();
                codex        = new GUI.Codex();
                codexpopup   = new CodexPopup();
                lootUI       = new LootUI();
                Chatbox      = new ChatboxOverUI();

                StaminaUserInterface.SetState(stamina);
                CollectionUserInterface.SetState(collection);
                OverlayUserInterface.SetState(overlay);
                InfusionUserInterface.SetState(infusion);
                CookingUserInterface.SetState(cooking);
                KeyInventoryUserInterface.SetState(keyinventory);
                TextCardUserInterface.SetState(textcard);
                CodexUserInterface.SetState(codex);
                CodexPopupUserInterface.SetState(codexpopup);
                LootUserInterface.SetState(lootUI);
                ChatboxUserInterface.SetState(Chatbox);
            }

            //particle systems
            if (!Main.dedServ)
            {
                LoadVitricBGSystems();
            }

            //Hooking
            HookOn();
            HookIL();
        }
Exemplo n.º 6
0
        public void Init()
        {
            for (int i = 0; i < 20; i++)
            {
                var card = new RectCard();
                card.PositionBehavior.Position = new Vector2f(i * 30 + 300, i % 10 * 30 + 300);
                this.Cards.Add(card);

                if (i <= 10)
                {
                    var textCard = new TextCard();
                    textCard.PositionBehavior.Position = new Vector2f(i * 30 + 340, i % 10 * 30 + 300);
                    this.Cards.Add(textCard);
                }
                else
                {
                    var textBlockCard = new TextBlockCard();
                    textBlockCard.PositionBehavior.Position = new Vector2f(i * 30 + 340, i % 10 * 30 + 300);
                    textBlockCard.TextBehavior.Value        = "SHIFT & DRAG to multi-select";
                    this.Cards.Add(textBlockCard);
                }
            }


            var list = new VerticalListCard(false);

            list.AddChild(new RectCard());
            list.AddChild(new TextCard());

            var drop = new DropAreaCard();

            drop.OnDrop += (o, e) =>
            {
                foreach (var card in e.Cards) // add on drop
                {
                    if (this.Cards.Contains(card))
                    {
                        this.Cards.Remove(card);
                    }

                    list.AddChild(card);
                }
            };

            list.AddChild(drop);

            list.AddChild(new ButtonCard("Button1", (s, e) =>
            {
                var card = new TextCard();
                card.TextBehavior.Value = $"Added via button";
                //card.PositionBehavior.Position = new Vector2f(0, 10000); // order FIX NEEDED!
                list.AddChild(card);
            }));

            list.PositionBehavior.Position = new Vector2f(300, 740);

            var innerList = new HorizontalListCard(false, 10);

            innerList.AddChild(new RectCard());
            innerList.AddChild(new TextCard());
            innerList.AddChild(new RectCard());

            list.AddChild(innerList);

            this.Cards.Add(list);
        }
Exemplo n.º 7
0
        //发送消息
        public static string SendMessage(Receiver receiver, string msgtype, Content content, string media_id, int safe, string token)
        {
            int             agentid     = Convert.ToInt32(ConfigurationManager.AppSettings["agentid"]);
            string          result      = "";
            string          messagejson = "";
            Text            text;
            TextMessage     textmessage;
            Articles        articles;
            List <Articles> listarticle;

            switch (msgtype)
            {
            case "text":
                text                = new Text();
                textmessage         = new TextMessage();
                text.content        = content.text;
                textmessage.touser  = receiver.touser;
                textmessage.toparty = receiver.toparty;
                textmessage.totag   = receiver.totag;
                textmessage.msgtype = msgtype;
                textmessage.agentid = agentid;
                textmessage.text    = text;
                messagejson         = JsonConvert.SerializeObject(textmessage);
                result              = PostJson(token, messagejson);
                break;

            case "image":
                Image image = new Image();
                image.media_id = media_id;
                ImageMessage imagemessage = new ImageMessage();
                imagemessage.touser  = receiver.touser;
                imagemessage.msgtype = msgtype;
                imagemessage.agentid = agentid;
                imagemessage.image   = image;
                messagejson          = JsonConvert.SerializeObject(imagemessage);
                result = PostJson(token, messagejson);
                break;

            case "voice":
                Voice voice = new Voice();
                voice.media_id = media_id;
                VoiceMessage voicemessage = new VoiceMessage();
                voicemessage.touser  = receiver.touser;
                voicemessage.msgtype = msgtype;
                voicemessage.agentid = agentid;
                voicemessage.voice   = voice;
                messagejson          = JsonConvert.SerializeObject(voicemessage);
                result = PostJson(token, messagejson);
                break;

            case "file":
                Files file = new Files();
                file.media_id = media_id;
                FilesMessage filemessage = new FilesMessage();
                filemessage.touser  = receiver.touser;
                filemessage.msgtype = msgtype;
                filemessage.agentid = agentid;
                filemessage.file    = file;
                messagejson         = JsonConvert.SerializeObject(filemessage);
                result = PostJson(token, messagejson);
                break;

            case "video":
                Video video = new Video();
                video.media_id    = media_id;
                video.title       = content.title;
                video.description = content.description;
                VideoMessage videomessage = new VideoMessage();
                videomessage.touser  = receiver.touser;
                videomessage.msgtype = msgtype;
                videomessage.agentid = agentid;
                videomessage.video   = video;
                messagejson          = JsonConvert.SerializeObject(videomessage);
                result = PostJson(token, messagejson);
                break;

            case "textcard":
                TextCard textcard = new TextCard();
                textcard.title       = content.title;
                textcard.description = content.description;
                textcard.url         = content.url;
                textcard.btntxt      = content.btntxt;
                TextCardMessage textcardmessage = new TextCardMessage();
                textcardmessage.touser   = receiver.touser;
                textcardmessage.msgtype  = msgtype;
                textcardmessage.agentid  = agentid;
                textcardmessage.textcard = textcard;
                messagejson = JsonConvert.SerializeObject(textcardmessage);
                result      = PostJson(token, messagejson);
                break;

            case "news":
                News news = new News();
                articles             = new Articles();
                articles.title       = content.title;
                articles.description = content.description;
                articles.url         = content.url;
                articles.picurl      = content.picurl;
                articles.btntxt      = content.btntxt;
                listarticle          = new List <Articles>();
                listarticle.Add(articles);
                news.articles = listarticle;
                NewsMessage newsmessage = new NewsMessage();
                newsmessage.touser  = receiver.touser;
                newsmessage.msgtype = msgtype;
                newsmessage.agentid = agentid;
                newsmessage.news    = news;
                messagejson         = JsonConvert.SerializeObject(newsmessage);
                result = PostJson(token, messagejson);
                break;

            case "mpnews":
                MpNews mpnews = new MpNews();
                articles                    = new Articles();
                articles.title              = content.title;
                articles.thumb_media_id     = media_id;
                articles.author             = content.author;
                articles.content_source_url = content.url;
                articles.content            = content.content;
                articles.digest             = content.description;
                listarticle                 = new List <Articles>();
                listarticle.Add(articles);
                mpnews.articles = listarticle;
                MpNewsMessage mpnewsmessage = new MpNewsMessage();
                mpnewsmessage.touser  = receiver.touser;
                mpnewsmessage.msgtype = msgtype;
                mpnewsmessage.agentid = agentid;
                mpnewsmessage.mpnews  = mpnews;
                messagejson           = JsonConvert.SerializeObject(mpnewsmessage);
                result = PostJson(token, messagejson);
                break;

            default:
                text                = new Text();
                textmessage         = new TextMessage();
                text.content        = content.text;
                textmessage.touser  = receiver.touser;
                textmessage.msgtype = msgtype;
                textmessage.agentid = agentid;
                textmessage.text    = text;
                messagejson         = JsonConvert.SerializeObject(textmessage);
                result              = PostJson(token, messagejson);
                break;
            }
            return(result);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 文本卡片消息
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="touser"></param>
        /// <param name="toparty"></param>
        /// <param name="totag"></param>
        /// <param name="agentid"></param>
        /// <param name="textCard"></param>
        /// <param name="safe"></param>
        /// <returns></returns>
        public static async Task <SendMessageResult> SendTextCardAsync(string corpID, string access_token, IEnumerable <string> touser, IEnumerable <string> toparty, IEnumerable <string> totag, int agentid, TextCard textCard)
        {
            var url = $"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={access_token}";

            var param = $@"
            {{
               ""touser"" : ""{touser.ToStitchingString('|')}"",
               ""toparty"" : ""{toparty.ToStitchingString('|')}"",
               ""totag"" : ""{totag.ToStitchingString('|')}"",
               ""msgtype"" : ""textcard"",
               ""agentid"" : {agentid},
               ""textcard"" : {textCard.ToString(corpID)}
            }}";

            return(await HttpClientManager.PostAsync <SendMessageResult>(url, param));
        }