Ejemplo n.º 1
0
        internal void AnalyzeText()
        {
            _Text = _Text
                .Replace("&", "&")
                .Replace("&lt;", "<")
                .Replace("&gt;", ">");
            TextElements = new List<StatusElement>();

            var el = new List<EntityInfo>();
            if (origin.Entities != null)
            {
                if (origin.Entities.Urls != null) el.AddRange(origin.Entities.Urls.Select(p => new EntityInfo { Indices = p.Indices, Text = p.DisplayUrl, Infomation = p.ExpandedUrl.ToString(), Type = "Url" }));
                if (origin.Entities.Media != null) el.AddRange(origin.Entities.Media.Select(p => new EntityInfo { Indices = p.Indices, Text = p.DisplayUrl, Infomation = p.ExpandedUrl.ToString(), Type = "Media" }));
                if (origin.Entities.UserMentions != null) el.AddRange(origin.Entities.UserMentions.Select(p => new EntityInfo { Indices = p.Indices, Text = "@" + p.ScreenName, Infomation = p.ScreenName, Type = "Mention" }));
                if (origin.Entities.HashTags != null) el.AddRange(origin.Entities.HashTags.Select(p => new EntityInfo { Indices = p.Indices, Text = "#" + p.Text, Infomation = p.Text, Type = "Hashtag" }));
                el.Sort((x, y) => x.Indices[0].CompareTo(y.Indices[0]));
            }
            int n = 0;
            string s = _Text;
            foreach (var i in el)
            {
                i.Indices[0] = i.Indices[0] >= s.Length ? s.Length - 1 : i.Indices[0];
                var ssi = i.Indices[0] - n;
                ssi = (i.Indices[0] + ssi > s.Length) ? (s.Length - n) : ssi;
                TextElements.Add(new StatusElement { Text = s.Substring(n, ssi), Type = "None" });
                TextElements.Add(new StatusElement { Text = i.Text, Infomation = i.Infomation, Type = i.Type });
                n = (i.Indices[1] >= s.Length - 1) ? s.Length - 1 : i.Indices[1];
            }
            if (n < s.Length - 1) TextElements.Add(new StatusElement { Text = s.Substring(n), Type = "None" });
        }
Ejemplo n.º 2
0
        public TitleChildSceneOptionEdit(User[] op)
        {
            opts = op;
            osi = new int[opts.Length];
            oii = new OptionInitializationInformation[opts.Length];
            sum = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "オプション装備編集", X = 230, Y = 8 };
            type = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Blue) { Value = "装備タイプ", X = 160, Y = 32 + 8 };
            dirc = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Green) { Value = "装備方向", X = 160, Y = 64 + 8 };
            mode = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Green) { Value = "モード", X = 160, Y = 96 + 8 };
            uvdesc = new List<StringSprite>()
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Red) { Value = "装備固有オプション1", X = 160, Y = 128 + 8 },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Red) { Value = "装備固有オプション2", X = 160, Y = 160 + 8 },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Red) { Value = "装備固有オプション3", X = 160, Y = 192 + 8 },
            };

            seltype = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 32 + 8 };
            seldirc = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 64 + 8 };
            selmode = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 96 + 8 };
            ipuvdesc = new List<StringSprite>()
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 128 + 8 },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 160 + 8 },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 192 + 8 },
            };

            uvs = new List<StringSprite>();
            uvs.Add(type);
            uvs.Add(dirc);
            uvs.Add(mode);
            uvs.AddRange(uvdesc);

            seluvs = new List<StringSprite>();
            seluvs.Add(seltype);
            seluvs.Add(seldirc);
            seluvs.Add(selmode);
            seluvs.AddRange(ipuvdesc);

            uvsmal = new List<MenuAllocationInformation>
            {
                new MenuAllocationInformation{ X = 144, Y = 48 },
                new MenuAllocationInformation{ X = 144, Y = 80 },
                new MenuAllocationInformation{ X = 144, Y = 112 },
                new MenuAllocationInformation{ X = 144, Y = 144 },
                new MenuAllocationInformation{ X = 144, Y = 176 },
                new MenuAllocationInformation{ X = 144, Y = 208 },
            };

            for (int i = 0; i < uvsmal.Count; i++)
            {
                int ci = i;
                uvsmal[i].Upper = uvsmal[(i + uvsmal.Count - 1) % uvsmal.Count];
                uvsmal[i].Lower = uvsmal[(i + 1) % uvsmal.Count];
                uvsmal[i].AvailableChangingAction =
                    (p, v) =>
                    {
                        uvs[ci].Alpha = seluvs[ci].Alpha = v ? 1.0 : 0.5;
                    };
                if (i >= 1) uvsmal[i].IsAvailable = false;
            }

            udc = new[]
            {
                new MultiAdditionalCoroutineSprite(){HomeX=64,HomeY=64,ScaleX=0.8,ScaleY=0.4,Image=CommonObjects.ImageCursor128[2],X=64,Y=48},
                new MultiAdditionalCoroutineSprite(){HomeX=64,HomeY=64,ScaleX=0.8,ScaleY=0.4,Image=CommonObjects.ImageCursor128[3],X=64,Y=208},
            };
            selopts = new List<MultiAdditionalCoroutineSprite>();
            foreach (var i in opts)
            {
                if (i == null) continue;
                selopts.Add(new MultiAdditionalCoroutineSprite() { HomeX = 48, HomeY = 48, X = 64, Y = 128, Image = BigUserImageManager.GetUserImage(i), Alpha = 0 });
            }
            avu = selopts.Count;
            for (int i = 0; i < avu; i++)
            {
                osi[i] = 0;
                oii[i] = new OptionInitializationInformation();
            }
            selopts.Add(new MultiAdditionalCoroutineSprite() { HomeX = 48, HomeY = 48, X = 64, Y = 128, Image = CommonObjects.ImageOptionEditEnd, Alpha = 0 });
            selopts[usel].Alpha = 1;

            mc = new MultiAdditionalCoroutineSprite() { Image = CommonObjects.ImageCursor128[1], HomeX = 64, HomeY = 64, ScaleX = 0.25, ScaleY = 0.25 };
            mc.X = uvsmal[smsel].X;
            mc.Y = uvsmal[smsel].Y;
        }
Ejemplo n.º 3
0
        private List<DirectMessage> getTalkDm(DirectMessage dm)
        {
            User talkingUser = dm.Sender;

            var dmRecieved = tokens.DirectMessages.Received(count => 200).Where(x => x.Sender.ScreenName == talkingUser.ScreenName);
            var dmSent = tokens.DirectMessages.Sent(count => 200).Where(x => x.Recipient.ScreenName == talkingUser.ScreenName);

            List<DirectMessage> dmList = new List<DirectMessage>();
            dmList.AddRange(dmRecieved);
            dmList.AddRange(dmSent);

            var query = dmList.OrderByDescending(s => s.CreatedAt);
            List<DirectMessage> talk = query.ToList<DirectMessage>();

            return talk;
        }
Ejemplo n.º 4
0
 public SceneGame(Kbtter4Account ac, UserInformation ui, OptionInformation[] opt)
 {
     optinfo = opt.Where(p => p != null).ToArray();
     info = ui;
     TwitterTokens = Tokens.Create(Kbtter.Setting.Consumer.Key, Kbtter.Setting.Consumer.Secret, ac.AccessToken, ac.AccessTokenSecret);
     Player = new PlayerUser(this, ui, PlayerMovingOperations.MouseOperaiton, PlayerShotOperations.Default, PlayerInputMethods.DefaultStyle);
     BackgroundImagePath = CommonObjects.GetUserFilePath("back_" + ui.SourceUser.Id.ToString() + ".png");
     Information = new InformationBox(info, Player)
     {
         X = 0,
         Y = 480
     };
     StringInfo = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.White)
     {
         X = 280,
         Y = 240,
         Value = "Loading"
     };
     options = new List<PlayerOption>();
     options.AddRange(optinfo.Select(p => new PlayerOption(Player, p, this)));
 }