Inheritance: MonoBehaviour
コード例 #1
0
ファイル: config.cs プロジェクト: ZakFahey/Collective-Health
        public static bool ReadConfig()
        {
            string filepath = Path.Combine(TShock.SavePath, "ColHealthConfig.json");

            try {
                if (File.Exists(filepath)) {
                    using (var stream = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                        using (var sr = new StreamReader(stream)) {
                            var configString = sr.ReadToEnd();
                            contents = JsonConvert.DeserializeObject<Contents>(configString);
                        }
                        stream.Close();
                    }
                    return true;
                } else {
                    CreateConfig();
                    Log.ConsoleInfo("Created ColHealthConfig.json.");
                    return true;
                }
            }
            catch (Exception e) {
                Log.ConsoleError(e.Message);
            }
            return false;
        }
コード例 #2
0
 public ContentsMessage(Container container, Contents contents)
 {
     this.ContainerID = container.ID;
     this.Keys = contents.Keys;
     this.Data = contents.Data;
     this.Meta = contents.Meta;
 }
コード例 #3
0
ファイル: config.cs プロジェクト: ZakFahey/Easy-Classes
        public static void CreateConfig(string fname, bool statistics)
        {
            string filepath = Path.Combine(TShock.SavePath, "Classes", fname);

            try
            {
                using (var stream = new FileStream(filepath, FileMode.Create, FileAccess.Write, FileShare.Write))
                {
                    using (var sr = new StreamWriter(stream))
                    {
                        string configString;
                        if (statistics)
                        {
                            stats = new Stats();
                            configString = JsonConvert.SerializeObject(stats, Formatting.Indented);
                        }
                        else
                        {
                            contents = new Contents();
                            configString = JsonConvert.SerializeObject(contents, Formatting.Indented);
                        }
                        sr.Write(configString);
                    }
                    stream.Close();
                }
            }
            catch (Exception e)
            {
                Log.ConsoleError(e.Message);
                if (statistics) stats = new Stats();
                else contents = new Contents();
            }
        }
コード例 #4
0
 public Content(Contents type, string[] commandParams)
 {
     this.Type = type;
     this.Title = commandParams[(int)Atributes.Title];
     this.Author = commandParams[(int)Atributes.Author];
     this.Size = long.Parse(commandParams[(int)Atributes.Size]);
     this.Url = commandParams[(int)Atributes.Url];
 }
コード例 #5
0
ファイル: AudioDevice.cs プロジェクト: Daramkun/Misty
 public IAudioBuffer CreateAudioBuffer( Contents.AudioInfo audioInfo )
 {
     IAudioBuffer buffer = null;
     Core.Dispatch ( () =>
     {
         buffer = new AudioBuffer ( this, audioInfo );
         audioList.Add ( buffer );
     } );
     return buffer;
 }
コード例 #6
0
        public ActionResult Articles()
        {
            var model1 = new Contents();
            model1.GetContentForUser(Convert.ToInt32(_mu.ProviderUserKey));

            var model = new Contents();
            model.AddRange(model1.OrderByDescending(p => p.CreateDate));

            return View(model);
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: hmxiaoxiao/leo
        private static void RunAnalyze()
        {
            Contents c = new Contents();
            Sasac web = new Sasac();

            web.FindedLink += c.SaveContents;
            web.FindedLink += DebugOut;

            web.UpdatePages();

            return;
        }
コード例 #8
0
        /// <summary>
        /// Builds the contents object
        /// </summary>
        /// <param name="tracks">The tracks source</param>
        /// <param name="filter">The filter object which contains the parameters with which to query for items</param>
        /// <param name="container">The container the tracks are sources from</param>
        /// <returns>A filled contents object</returns>
        Contents BuildContents(IEnumerable<Track> tracks, Options filter, IContainer container)
        {
            // Get type
            var type = (filter.ContainsKey("type") ? filter["type"] : container.ViewTypes.FirstOrDefault()) ?? Types.Track;

            // Create contents instance
            var contents = new Contents(container);

            // Set meta data
            dynamic meta = new ExpandoObject();
            contents.Meta = meta;
            meta.Shuffable = type == Types.Track;
            meta.SortedByAlpha = container is MasterPlaylist || container is WebcastContainer;

            // Get the data for the given type
            switch(type) {
                case Types.Track:
                    contents.Data = GetTracksData(tracks, meta.SortedByAlpha);
                    contents.Keys = new string[] { "id", "name", "artist", "album", "albumArtist", "number", "duration", "index" };
                    if (filter.ContainsKey("albumid")) {
                        meta.Albumid = filter["albumid"];
                        meta.TotalDuration = (int)(tracks.Aggregate(TimeSpan.Zero, (total, t) => total + t.Duration).TotalSeconds);
                    }
                    break;
                case Types.Album:
                    contents.Data = GetAlbumsData(tracks);
                    contents.Keys = new string[] { "id", "album", "artist", "artworkid", "index" };
                    break;
                case Types.Artist:
                    contents.Data = GetArtistsData(tracks);
                    contents.Keys = new string[] { "artist", "albums", "tracks", "index" };
                    break;
                case Types.Genre:
                    contents.Data = GetGenresData(tracks);
                    contents.Keys = new string[] { "genre", "index" };
                    break;
                case Types.Webcast:
                    contents.Data = GetWebcastsData(tracks);
                    contents.Keys = new string[] { "id", "name", "index" };
                    break;
            }

            return contents;
        }
コード例 #9
0
ファイル: config.cs プロジェクト: ZakFahey/Collective-Health
        public static void CreateConfig()
        {
            string filepath = Path.Combine(TShock.SavePath, "ColHealthConfig.json");

            try {
                using (var stream = new FileStream(filepath, FileMode.Create, FileAccess.Write, FileShare.Write)) {
                    using (var sr = new StreamWriter(stream)) {
                        contents = new Contents();
                        var configString = JsonConvert.SerializeObject(contents, Formatting.Indented);
                        sr.Write(configString);
                    }
                    stream.Close();
                }
            }
            catch (Exception e) {
                Log.ConsoleError(e.Message);
                contents = new Contents();
            }
        }
コード例 #10
0
        public void GenerateChamberContents()
        {
            var generatedContents = new Contents();
            generatedContents.Encounters = new[] { new Encounter(), new Encounter() };
            generatedContents.Miscellaneous = new[] { "thing 1", "thing 2" };
            generatedContents.Traps = new[] { new Trap(), new Trap() };
            generatedContents.Treasures = new[] { new DungeonTreasure(), new DungeonTreasure() };

            mockContentsGenerator.Setup(g => g.Generate(600)).Returns(generatedContents);

            var chambers = chamberGenerator.Generate(42, 600, "temperature");
            var contents = chambers.Single().Contents;

            Assert.That(contents.Encounters.Count(), Is.EqualTo(2));
            Assert.That(contents.Miscellaneous, Contains.Item("thing 1"));
            Assert.That(contents.Miscellaneous, Contains.Item("thing 2"));
            Assert.That(contents.Miscellaneous.Count(), Is.EqualTo(2));
            Assert.That(contents.Traps.Count(), Is.EqualTo(2));
            Assert.That(contents.Treasures.Count(), Is.EqualTo(2));
        }
コード例 #11
0
 public override void OnInspectorGUI()
 {
     if (s_Contents == null)
     {
         s_Contents = new Contents();
     }
     if (!EditorGUIUtility.wideMode)
     {
         EditorGUIUtility.wideMode = true;
         EditorGUIUtility.labelWidth = EditorGUIUtility.currentViewWidth - 212f;
     }
     base.serializedObject.Update();
     this.Inspector3D();
     Transform target = base.target as Transform;
     Vector3 position = target.position;
     if (((Mathf.Abs(position.x) > 100000f) || (Mathf.Abs(position.y) > 100000f)) || (Mathf.Abs(position.z) > 100000f))
     {
         EditorGUILayout.HelpBox(s_Contents.floatingPointWarning, MessageType.Warning);
     }
     base.serializedObject.ApplyModifiedProperties();
 }
コード例 #12
0
ファイル: SiteAdminController.cs プロジェクト: ryn0/kommunity
        public ActionResult Articles()
        {
            int totalRecords;
            const int pageSize = 10;
            var model = new Contents();

            if (string.IsNullOrEmpty(Request.QueryString[SiteEnums.QueryStringNames.pg.ToString()]))
            {
                totalRecords = model.GetContentPageWiseAll(1, pageSize);
            }
            else
            {
                int pageNumber = Convert.ToInt32(Request.QueryString[SiteEnums.QueryStringNames.pg.ToString()]);

                totalRecords = model.GetContentPageWiseAll(pageNumber, pageSize);
            }

            ViewBag.PageCount = (totalRecords + pageSize - 1)/pageSize;

            return View(model);
        }
コード例 #13
0
ファイル: config.cs プロジェクト: ZakFahey/Easy-Classes
        public static bool ReadConfig(string fname, TSPlayer plr, bool statistics)
        {
            string filepath = Path.Combine(TShock.SavePath, "Classes", fname);

            try
            {
                if (File.Exists(filepath))
                {
                    using (var stream = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        using (var sr = new StreamReader(stream))
                        {
                            var configString = sr.ReadToEnd();
                            if (statistics)
                                stats = JsonConvert.DeserializeObject<Stats>(configString);
                            else
                            {
                                contents = JsonConvert.DeserializeObject<Contents>(configString);
                                contents.playerClasses.RemoveRange(0, 3);//Delete default classes
                            }
                        }
                        stream.Close();
                    }
                    return true;
                }
                else
                {
                    CreateConfig(fname, statistics);
                    Log.ConsoleInfo(String.Format("Created {0}", fname));
                    plr.SendSuccessMessage(String.Format("Created {0}", fname));
                    return true;
                }
            }
            catch (Exception e)
            {
                Log.ConsoleError(e.Message);
            }
            return false;
        }
コード例 #14
0
        public ActionResult Create(Contents contents)
        {
            if (ModelState.IsValid)
            {
                var c = Request.Files[0];
                if (c != null && c.ContentLength > 0)
                {
                    int lastSlashIndex = c.FileName.LastIndexOf("\\");
                    string fileName = c.FileName.Substring(lastSlashIndex + 1, c.FileName.Length - lastSlashIndex - 1);
                    int lastDotIndex = fileName.LastIndexOf(".");
                    string fileType = fileName.Substring(lastDotIndex + 1);
                    string guid = Guid.NewGuid().ToString();
                    string realName = guid + "." + fileType;
                    string savePath = Path.Combine(Server.MapPath("/Documents/"), realName);
                    c.SaveAs(savePath);

                    contents.Name = fileName.Substring(0, lastDotIndex);
                    contents.Title = contents.Name;
                    contents.RealName = realName;
                    contents.Extension = fileType;
                    contents.Size =c.ContentLength;
                    contents.StatusId = 0;
                    contents.MainBody ="";
                    contents.CreaterId =(int)Session["CurrentEmp"];
                    contents.CreateTime = DateTime.Now;
                    db.Contents.Add(contents);
                    var readLog = new ReadLog { EmpId = (int)Session["CurrentEmp"], ContentId = contents.Id,ReadTime=DateTime.Now};
                    db.ReadLog.Add(readLog);
                    db.SaveChanges();
                    return Redirect("Index/" + Request.QueryString["modelId"] + "?productId=" + Request.QueryString["productId"]);
                }
            }

            IEnumerable<Menus> modelMenus = db.Database.SqlQuery<Menus>(string.Format(_queryStr, 30));
            ViewBag.ModelId = new SelectList(modelMenus, "Id", "Title", contents.ModelId);
            IEnumerable<Menus> productMenus = db.Database.SqlQuery<Menus>(string.Format(_queryStr, 8));
            ViewBag.ProductId = new SelectList(productMenus, "Id", "Title",contents.ProductId);
            return View(contents);
        }
コード例 #15
0
        public ActionResult Articles()
        {
            int totalRecords = 0;
            const int pageSize = 10;
            var model = new Contents();

            if (string.IsNullOrEmpty(Request.QueryString[SiteEnums.QueryStringNames.pg.ToString()]))
            {
                if (_mu != null) model.GetContentForUser(Convert.ToInt32(_mu.ProviderUserKey));

                model.Sort((p1, p2) => p2.ReleaseDate.CompareTo(p1.ReleaseDate));
            }
            else
            {
                int pageNumber = Convert.ToInt32(Request.QueryString[SiteEnums.QueryStringNames.pg.ToString()]);

                totalRecords = model.GetContentPageWiseAll(pageNumber, pageSize);
            }

            ViewBag.PageCount = (totalRecords + pageSize - 1) / pageSize;

            return View(model);
        }
コード例 #16
0
 protected List <SoundContent> GetSoundContents()
 {
     return(Contents.Where(c => c.ContentType == ContentTypeFlag.Sound)
            .Cast <SoundContent>()
            .ToList());
 }
コード例 #17
0
 protected List <TextContent> GetTextContents()
 {
     return(Contents.Where(c => (c.ContentType & ContentTypeFlag.Text) != ContentTypeFlag.None)
            .Cast <TextContent>()
            .ToList());
 }
コード例 #18
0
ファイル: Tile.cs プロジェクト: AlexaDeWit/SimpleRoguelike
 public T FirstEntityOfType <T>() where T : Entity
 {
     return(Contents.OfType <T> ().FirstOrDefault());
 }
コード例 #19
0
 public override int GetHashCode()
 {
     return(Contents.GetHashCode());
 }
コード例 #20
0
 public VGPIfElse(Conditional first_condition, VGPBlock parent)
     : this(parent) {
     Contents.Add(first_condition);
 }
コード例 #21
0
ファイル: NewsController.cs プロジェクト: dasklub/kommunity
        public ActionResult Index()
        {
            var model = new Contents();

            model.GetContentPageWiseReleaseAll(1, PageSize);

            return View(model);
        }
コード例 #22
0
        private void GetUserNews(ProfileModel model)
        {
            var conts = new Contents();

            conts.GetContentForUser(_ua.UserAccountID);

            var userNews = new List<Content>();

            foreach(var newsItem in conts)
            {
                if (newsItem.IsLive) userNews.Add(newsItem);
            }

            model.NewsCount = userNews.Count;

            if (userNews.Count > 0)
            {
                userNews.Sort((x, y) => (y.ReleaseDate.CompareTo(x.ReleaseDate)));

                var displayContents = new Contents();
                const int maxCont = 1;
                int currentCount = 0;

                foreach (Content ccn1 in userNews)
                {
                    if (maxCont > currentCount)
                    {
                        if (ccn1.ReleaseDate >= DateTime.UtcNow) continue;

                        currentCount++;
                        displayContents.Add(ccn1);
                    }
                    else break;
                }

                displayContents.IncludeStartAndEndTags = false;

                model.NewsArticles = displayContents.ToUnorderdList;
            }
        }
コード例 #23
0
        public ActionResult UserNews(string userName)
        {
            _ua = new UserAccount(userName);

            ViewBag.UserName = _ua.UserName;

            var conts = new Contents();

            conts.GetContentForUser(_ua.UserAccountID);

            conts.IncludeStartAndEndTags = false;

            conts.Sort((x, y) => (y.ReleaseDate.CompareTo(x.ReleaseDate)));

            var contentToLoad = new Contents();
            contentToLoad.AddRange(conts.Where(content => content.ReleaseDate < DateTime.UtcNow));

            ViewBag.NewsCount = contentToLoad.Count;

            return View(contentToLoad);
        }
コード例 #24
0
ファイル: Emitter.cs プロジェクト: jrichter42/Particel
        public void DrawExtraDebug(DebugFlag extraFlag, SpriteBatch batch, Camera cam, Contents content)
        {
            batch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, cam.ViewMatrix);

            batch.Draw(EmitterTexture, Position, null, Color.White, 0, this.Origin, 1.0f, SpriteEffects.None, 1f);
            foreach (Vector2 v in EmitterAngel)
            {
                drawPartCircel(50, v.X, v.Y, Position, batch, content.Pixel);
            }
            drawLine(Position, new Vector2(Position.X + EmitterRange.X, 0 + Position.Y), content.Pixel, 1, batch);
            drawLine(Position, new Vector2(Position.X - EmitterRange.X, 0 + Position.Y), content.Pixel, 1, batch);
            drawLine(Position, new Vector2(Position.X, Position.Y + EmitterRange.Y), content.Pixel, 1, batch);
            drawLine(Position, new Vector2(Position.X, Position.Y - EmitterRange.Y), content.Pixel, 1, batch);

            batch.End();
        }
コード例 #25
0
ファイル: HomeController.cs プロジェクト: dasklub/kommunity
        private Contents LoadRecentArticles()
        {
            var cnts = new Contents();
            cnts.GetContentPageWiseReleaseAll(1, CountOfNewsItemsOnHomepage);

            return cnts;
        }
コード例 #26
0
 public GroupMessage(QQGroup group, string text) : this()
 {
     Group = group;
     Contents.Add(new TextItem(text));
     Contents.Add(new FontItem());
 }
コード例 #27
0
ファイル: Bag.cs プロジェクト: juliaseid/packer-tracker
 public List <Item> AddToBag(Item myItem)
 {
     Contents.Add(myItem);
     return(Contents);
 }
コード例 #28
0
ファイル: NewsController.cs プロジェクト: dasklub/kommunity
        public JsonResult Items(int pageNumber)
        {
            var model = new Contents();

            model.GetContentPageWiseReleaseAll(pageNumber, PageSize);

            var sb = new StringBuilder();

            foreach (Content cnt in model)
            {
                sb.Append(cnt.ToUnorderdListItem);
            }

            return Json(new
            {
                ListItems = sb.ToString()
            });
        }
コード例 #29
0
 public void Add(string key, JsonToken value)
 {
     Contents.Add(value);
 }
コード例 #30
0
ファイル: NewsController.cs プロジェクト: dasklub/kommunity
        public ActionResult Lang(string lang)
        {
            ViewBag.Lang = lang;

            var model = new Contents();

            int total = model.GetContentPageWiseRelease(1, PageSize, lang);

            ViewBag.EnableLoadingMore = (PageSize < total);

            return View(model);
        }
コード例 #31
0
        public BodyScannerDisplay(BodyScannerBoundUserInterface owner)
        {
            IoCManager.InjectDependencies(this);
            Owner = owner;
            Title = Loc.GetString("Body Scanner");

            var hSplit = new HBoxContainer
            {
                Children =
                {
                    // Left half
                    new ScrollContainer
                    {
                        SizeFlagsHorizontal = SizeFlags.FillExpand,
                        Children            =
                        {
                            (BodyPartList = new ItemList())
                        }
                    },
                    // Right half
                    new VBoxContainer
                    {
                        SizeFlagsHorizontal = SizeFlags.FillExpand,
                        Children            =
                        {
                            // Top half of the right half
                            new VBoxContainer
                            {
                                SizeFlagsVertical = SizeFlags.FillExpand,
                                Children          =
                                {
                                    (BodyPartLabel          = new Label()),
                                    new HBoxContainer
                                    {
                                        Children            =
                                        {
                                            new Label
                                            {
                                                Text        = "Health: "
                                            },
                                            (BodyPartHealth = new Label())
                                        }
                                    },
                                    new ScrollContainer
                                    {
                                        SizeFlagsVertical = SizeFlags.FillExpand,
                                        Children          =
                                        {
                                            (MechanismList  = new ItemList())
                                        }
                                    }
                                }
                            },
                            // Bottom half of the right half
                            (MechanismInfoLabel = new RichTextLabel
                            {
                                SizeFlagsVertical = SizeFlags.FillExpand
                            })
                        }
                    }
                }
            };

            Contents.AddChild(hSplit);

            BodyPartList.OnItemSelected  += BodyPartOnItemSelected;
            MechanismList.OnItemSelected += MechanismOnItemSelected;
        }
コード例 #32
0
ファイル: NewsController.cs プロジェクト: dasklub/kommunity
        public JsonResult LangItems(int pageNumber, string lang)
        {
            ViewBag.Lang = lang;

            var model = new Contents();

            model.GetContentPageWiseRelease(pageNumber, PageSize, lang);

            var sb = new StringBuilder();

            foreach (Content cnt in model)
            {
                sb.Append(cnt.ToUnorderdListItem);
            }

            return Json(new
            {
                ListItems = sb.ToString()
            });
        }
コード例 #33
0
        /// <summary>
        /// 生成一个词典
        /// </summary>
        /// <param name="path"></param>
        /// <param name="contents">词典所要包含的信息</param>
        public void Build(string path, Contents contents)
        {
            FileStream stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Write);

            BinaryWriter writer = new BinaryWriter(stream, Encoding.UTF8);

            // 数据库信息,占用 8 bytes + 8 bytes = 16 bytes
            writer.Write(LEX_SIGNATURE);    // 词典标识符,4 bytes
            writer.Write(LEX_THIS_VERSION); // 词典版本,4 bytes
            writer.Write(new byte[8]);      // 保留位置,8 bytes

            // 偏移位置信息,占用 5 * 4 + 1 = 21 bytes
            writer.Write(OFS_WORDS_BACKWARD); // 1 byte
            writer.Write(0);                  // 逆向词汇起始位置,4 bytes
            writer.Write(OFS_WORDS_FORWARD);  // 1 byte
            writer.Write(0);                  // 正向词汇起始位置,4 bytes
            writer.Write(OFS_FREQS_WORDS);    // 1 byte
            writer.Write(0);                  // 词汇频率起始位置,4 bytes
            writer.Write(OFS_FREQS_CHARS);    // 1 byte
            writer.Write(0);                  // 单字频率起始位置,4 bytes
            writer.Write(OFS_END);

            int ofs_cur = (int)writer.BaseStream.Position;

            List <string> words = m_word_list.Words;

            // 逆向词汇
            if ((contents & Contents.WordsBackward) != 0)
            {
                TrieTree tree_b = new TrieTree();
                for (int i = 0; i < words.Count; i++)
                {
                    tree_b.AddString(this.ReverseString(words[i]));
                }

                ArrayList al_b    = tree_b.GetDoubleArrays();
                string[]  chars_b = (string[])al_b[0];
                int[][]   idxes_b = (int[][])al_b[1];
                int[]     ofses_b = new int[idxes_b.Length];

                writer.BaseStream.Seek(17, SeekOrigin.Begin);
                writer.Write(ofs_cur);
                writer.BaseStream.Seek(0, SeekOrigin.End);

                for (int i = 0; i < idxes_b.Length; i++)
                {
                    ofses_b[i] = ofs_cur;
                    ofs_cur   += Encoding.UTF8.GetByteCount(chars_b[i]) + idxes_b[i].Length * 4;
                }

                for (int i = 0; i < chars_b.Length; i++)
                {
                    byte[] buf = Encoding.UTF8.GetBytes(chars_b[i]);
                    writer.Write(buf.Length - 1);
                    writer.Write(buf);
                    for (int j = 1; j < idxes_b[i].Length; j++)
                    {
                        writer.Write(ofses_b[idxes_b[i][j]]);
                    }
                }
            }

            // 正向词汇
            if ((contents & Contents.WordsForward) != 0)
            {
                TrieTree tree_f = new TrieTree();
                for (int i = 0; i < words.Count; i++)
                {
                    tree_f.AddString(words[i]);
                }

                ArrayList al_f    = tree_f.GetDoubleArrays();
                string[]  chars_f = (string[])al_f[0];
                int[][]   idxes_f = (int[][])al_f[1];
                int[]     ofses_f = new int[idxes_f.Length];

                writer.BaseStream.Seek(22, SeekOrigin.Begin);
                writer.Write(ofs_cur);
                writer.BaseStream.Seek(0, SeekOrigin.End);

                for (int i = 0; i < idxes_f.Length; i++)
                {
                    ofses_f[i] = ofs_cur;
                    ofs_cur   += Encoding.UTF8.GetByteCount(chars_f[i]) + idxes_f[i].Length * 4;
                }

                for (int i = 0; i < chars_f.Length; i++)
                {
                    byte[] buf = Encoding.UTF8.GetBytes(chars_f[i]);
                    writer.Write(buf.Length - 1);
                    writer.Write(buf);
                    for (int j = 1; j < idxes_f[i].Length; j++)
                    {
                        writer.Write(ofses_f[idxes_f[i][j]]);
                    }
                }
            }

            // 词汇频率
            if ((contents & Contents.FreqsWords) != 0)
            {
//                lex["freqs_words"] = m_freq_list.Words;
            }

            // 单字频率
            if ((contents & Contents.FreqsChars) != 0)
            {
                writer.BaseStream.Seek(32, SeekOrigin.Begin);
                writer.Write(ofs_cur);
                writer.BaseStream.Seek(0, SeekOrigin.End);

                Dictionary <string, float> chars = m_freq_list.Chars;

                foreach (string key in chars.Keys)
                {
                    byte[] buf = Encoding.UTF8.GetBytes(key);
                    writer.Write(buf.Length);
                    writer.Write(buf);
                    writer.Write(chars[key]);
                }

                writer.Write(0);

                ofs_cur = (int)writer.BaseStream.Position;
            }

            writer.Flush();

            writer.Close();
        }
コード例 #34
0
ファイル: NewsController.cs プロジェクト: dasklub/kommunity
        public ActionResult Tag(string key)
        {
            if (string.IsNullOrEmpty(key)) return new EmptyResult();

            ViewBag.KeyName = key;

            key = key.Replace("-", " ");

            var model = new Contents();

            int total = model.GetContentPageWiseKeyRelease(1, PageSize, key);

            if (model.Count == 0)
            {
                // this might have had a dash in it
                model.GetContentPageWiseKeyRelease(1, PageSize, ViewBag.KeyName);

                if (model.Count == 0)
                {
                    // TODO: combination of with and without, deal with it
                }
            }

            ViewBag.EnableLoadingMore = (PageSize < total);

            ViewBag.TagName = key;

            return View(model);
        }
コード例 #35
0
ファイル: HomeController.cs プロジェクト: pakoito/web
        public ActionResult Index()
        {
            // CONTESTS

            Contest cndss = Contest.GetCurrentContest();
            ContestVideos cvids = new ContestVideos();

            Videos vidsInContest = new Videos();
            BootBaronLib.AppSpec.DasKlub.BOL.Video vid2 = null;

            foreach (ContestVideo cv1 in cvids)
            {
                vid2 = new BootBaronLib.AppSpec.DasKlub.BOL.Video(cv1.VideoID);
                vidsInContest.Add(vid2);
            }

            vidsInContest.Sort(delegate(BootBaronLib.AppSpec.DasKlub.BOL.Video p1, BootBaronLib.AppSpec.DasKlub.BOL.Video p2)
            {
                return p2.PublishDate.CompareTo(p1.PublishDate);
            });

            SongRecords sngrcds3 = new SongRecords();
            SongRecord sng3 = new SongRecord();

            foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in vidsInContest)
            {
                sng3 = new SongRecord(v1);

                sngrcds3.Add(sng3);
            }

            ViewBag.ContestVideoList = sngrcds3.VideosList();
            ViewBag.CurrentContest = cndss;

            //
            PhotoItems pitms = new PhotoItems();
            pitms.UseThumb = true;
            pitms.ShowTitle = false;
            pitms.GetPhotoItemsPageWise(1, 4);

            ViewBag.PhotoList = pitms.ToUnorderdList;

            Contents cnts = new Contents();
            cnts.GetContentPageWiseAll(1, 3);

            ViewBag.RecentArticles = cnts.ToUnorderdList;

            UserAccounts uas = new UserAccounts();
            uas.GetNewestUsers();
            ViewBag.NewestUsers = uas.ToUnorderdList;

            Videos newestVideos = new Videos();
            newestVideos.GetMostRecentVideos();
            SongRecords newSongs = new SongRecords();
            SongRecord sng1 = null;
            foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in newestVideos)
            {
                sng1 = new SongRecord(v1);
                newSongs.Add(sng1);
            }

            ViewBag.NewestVideos = newSongs.VideosList();

            BootBaronLib.AppSpec.DasKlub.BOL.Video vid = new BootBaronLib.AppSpec.DasKlub.BOL.Video(BootBaronLib.AppSpec.DasKlub.BOL.Video.RandomVideoIDVideo());

            ViewBag.RandomVideoKey = vid.ProviderKey;

            ///video submit
            MultiProperties addList = null;
            PropertyType propTyp = null;
            MultiProperties mps = null;

            // video typesa
            propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP);
            mps = new MultiProperties(propTyp.PropertyTypeID);
            mps.Sort(delegate(MultiProperty p1, MultiProperty p2)
            {
                return p1.DisplayName.CompareTo(p2.DisplayName);
            });

            ViewBag.VideoTypes = mps;

            // person types
            propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN);
            mps = new MultiProperties(propTyp.PropertyTypeID);
            mps.Sort(delegate(MultiProperty p1, MultiProperty p2)
            {
                return p1.DisplayName.CompareTo(p2.DisplayName);
            });

            ViewBag.PersonTypes = mps;

            //// footage types
            propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG);
            mps = new MultiProperties(propTyp.PropertyTypeID);
            mps.Sort(delegate(MultiProperty p1, MultiProperty p2)
            {
                return p1.DisplayName.CompareTo(p2.DisplayName);
            });
            addList = new MultiProperties();

            ViewBag.FootageTypes = mps;

            return View();
        }
コード例 #36
0
ファイル: NewsController.cs プロジェクト: dasklub/kommunity
        public ActionResult TagItems(string key, int pageNumber = 1)
        {
            var model = new Contents();

            model.GetContentAllPageWiseKey(pageNumber, PageSize, key.Replace("-", " "));

            if (model.Count == 0)
            {
                // this might have had a dash in it
                model.GetContentPageWiseKeyRelease(1, PageSize, ViewBag.KeyName);

                if (model.Count == 0)
                {
                    // TODO: combination of with and without, deal with it
                }
            }

            var sb = new StringBuilder();

            foreach (Content cnt in model)
            {
                sb.Append(cnt.ToUnorderdListItem);
            }

            return Json(new
            {
                ListItems = sb.ToString(),
                JsonRequestBehavior.AllowGet
            });
        }
コード例 #37
0
 protected List <ImageContent> GetImageContents()
 {
     return(Contents.Where(c => c.ContentType == ContentTypeFlag.Image)
            .Cast <ImageContent>()
            .ToList());
 }
コード例 #38
0
        /// <summary>
        ///     Draw the inspector widget.
        /// </summary>
        public override void OnInspectorGUI()
        {
            if (s_Contents == null)
            {
                s_Contents = new Contents();
            }

            serializedObject.Update();

            if (style == null)
            {
                style              = new GUIStyle("button");
                style.fixedWidth   = 18;
                style.stretchWidth = true;
                style.fixedHeight  = 16;
                style.margin       = new RectOffset(0, 0, 1, 2);
            }

            EditorGUIUtility.labelWidth = 24f;
            if (!EditorGUIUtility.wideMode)
            {
                EditorGUIUtility.wideMode = true;
            }

            EditorGUILayout.PropertyField(m_LocalPosition, s_Contents.positionContent);
            CallFieldMethod("m_RotationGUI", "RotationField", new Type[0], null);
            EditorGUILayout.PropertyField(m_LocalScale, s_Contents.scaleContent);

            Rect rect = GUILayoutUtility.GetLastRect();

            rect.width = style.fixedWidth;
            rect.y    -= 36;
            if (GUI.Button(rect, s_Contents.positionContent, style))
            {
                m_LocalPosition.vector3Value = Vector3.zero;
            }

            rect.y += 18;
            if (GUI.Button(rect, s_Contents.rotationContent, style))
            {
                m_LocalRotation.quaternionValue = Quaternion.identity;
            }

            rect.y += 18;
            if (GUI.Button(rect, s_Contents.scaleContent, style))
            {
                scale = 1;
                m_LocalScale.vector3Value = Vector3.one;
            }

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUIUtility.labelWidth = 37f;
                var newScale = EditorGUILayout.FloatField("Scale", scale);
                if (!Mathf.Approximately(scale, newScale))
                {
                    scale = newScale;
                    m_LocalScale.vector3Value = Vector3.one * scale;
                }

                EditorGUILayout.LabelField("Round", GUILayout.Width(42f));
                if (GUILayout.Button(".", "MiniButtonLeft"))
                {
                    Undo.RecordObjects(targets, "Round");
                    for (int i = 0; i < targets.Length; i++)
                    {
                        Transform o = targets[i] as Transform;
                        o.localPosition = Round(o.localPosition);
                        o.localScale    = Round(o.localScale);
                    }
                }

                if (GUILayout.Button(".0", "MiniButtonMid"))
                {
                    Undo.RecordObjects(targets, "Round");
                    for (int i = 0; i < targets.Length; i++)
                    {
                        Transform o = targets[i] as Transform;
                        o.localPosition = Round(o.localPosition, 1);
                        o.localScale    = Round(o.localScale, 1);
                    }
                }

                if (GUILayout.Button(".00", "MiniButtonRight"))
                {
                    Undo.RecordObjects(targets, "Round");
                    for (int i = 0; i < targets.Length; i++)
                    {
                        Transform o = targets[i] as Transform;
                        o.localPosition = Round(o.localPosition, 2);
                        o.localScale    = Round(o.localScale, 2);
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            // Copy
            EditorGUILayout.BeginHorizontal();
            {
                var c = GUI.color;
                GUI.color = new Color(1f, 1f, 0.5f, 1f);
                using (new EditorGUI.DisabledScope(Selection.objects.Length != 1))
                {
                    if (GUILayout.Button("Copy", "ButtonLeft"))
                    {
                        TransformInspectorCopyData.localPositionCopy = m_LocalPosition.vector3Value;
                        TransformInspectorCopyData.localRotationCopy = m_LocalRotation.quaternionValue;
                        TransformInspectorCopyData.loacalScaleCopy   = m_LocalScale.vector3Value;
                        Transform t = target as Transform;
                        TransformInspectorCopyData.positionCopy = t.position;
                        TransformInspectorCopyData.rotationCopy = t.rotation;
                    }
                }

                bool isGlobal = Tools.pivotRotation == PivotRotation.Global;
                GUI.color = new Color(1f, 0.5f, 0.5f, 1f);
                if (GUILayout.Button("Paste", "ButtonMid"))
                {
                    Undo.RecordObjects(targets, "Paste Local");
                    if (isGlobal)
                    {
                        PastePosition();
                        PasteRotation();
                    }
                    else
                    {
                        m_LocalPosition.vector3Value    = TransformInspectorCopyData.localPositionCopy;
                        m_LocalRotation.quaternionValue = TransformInspectorCopyData.localRotationCopy;
                        m_LocalScale.vector3Value       = TransformInspectorCopyData.loacalScaleCopy;
                    }
                }

                if (GUILayout.Button("PPos", "ButtonMid"))
                {
                    Undo.RecordObjects(targets, "PPos");
                    if (isGlobal)
                    {
                        PastePosition();
                    }
                    else
                    {
                        m_LocalPosition.vector3Value = TransformInspectorCopyData.localPositionCopy;
                    }
                }

                if (GUILayout.Button("PRot", "ButtonMid"))
                {
                    Undo.RecordObjects(targets, "PRot");
                    if (isGlobal)
                    {
                        PasteRotation();
                    }
                    else
                    {
                        m_LocalRotation.quaternionValue = TransformInspectorCopyData.localRotationCopy;
                    }
                }

                using (new EditorGUI.DisabledScope(isGlobal))
                {
                    if (GUILayout.Button("PSca", "ButtonMid"))
                    {
                        Undo.RecordObjects(targets, "PSca");
                        m_LocalScale.vector3Value = TransformInspectorCopyData.loacalScaleCopy;
                    }
                }

                //GUI.color = new Color(1f, 0.75f, 0.5f, 1f);
                GUIContent pivotRotationContent = s_Contents.pivotPasteGlobal;
                pivotRotationContent.text = "Global";
                if (Tools.pivotRotation == PivotRotation.Local)
                {
                    pivotRotationContent      = s_Contents.pivotPasteLocal;
                    pivotRotationContent.text = "Local";
                }

                GUI.color = c;
                if (GUILayout.Button(pivotRotationContent, "ButtonRight", GUILayout.MaxHeight(18)))
                {
                    Tools.pivotRotation = Tools.pivotRotation == PivotRotation.Local ? PivotRotation.Global : PivotRotation.Local;
                }
            }
            EditorGUILayout.EndHorizontal();

            DrawBottomPanel(target, targets);

            Transform transform = target as Transform;
            Vector3   position  = transform.position;

            if (Mathf.Abs(position.x) > 100000f || Mathf.Abs(position.y) > 100000f || Mathf.Abs(position.z) > 100000f)
            {
                EditorGUILayout.HelpBox(s_Contents.floatingPointWarning, MessageType.Warning);
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #39
0
        public string Build(List <ContentBase> contents)
        {
            var components = new List <IComponent>();

            var corsCount = Contents.Count(c => c.Cors != null);

            if (corsCount > 0 && corsCount != Contents.Count())
            {
                throw new ArgumentException("CORS must be set for all contents, or none.");
            }

            var txtContents   = GetTextContents();
            var imgContents   = GetImageContents();
            var soundContents = GetSoundContents();

            switch (ElemBuilder.ContentType)
            {
            case ContentTypeFlag.Html:
            case ContentTypeFlag.RawText:
                if (imgContents.Any())
                {
                    throw new InvalidCastException("ElementBuilder ContentTypeFlag.Text contains non-text IContent");
                }

                if (txtContents.Any() == false)
                {
                    throw new InvalidCastException("ElementBuilder ContentTypeFlag.Text does not contain any text IContent");
                }

                BuildTextComponents(0,
                                    txtContents.Count,
                                    CorsFull.Left,
                                    CorsFull.Top,
                                    CorsFull.Right,
                                    CorsFull.Bottom,
                                    txtContents,
                                    components);
                break;

            case ContentTypeFlag.Image:
                if (txtContents.Any())
                {
                    throw new InvalidCastException("ElementBuilder ContentTypeFlag.Image contains non-image IContent");
                }

                if (imgContents.Any() == false)
                {
                    throw new InvalidCastException("ElementBuilder ContentTypeFlag.Image does not contain any image IContent");
                }

                BuildImageComponents(0,
                                     imgContents.Count,
                                     CorsFull.Left,
                                     CorsFull.Top,
                                     CorsFull.Right,
                                     CorsFull.Bottom,
                                     imgContents,
                                     components);
                break;

            case ContentTypeFlag.Sound:
                if (txtContents.Any())
                {
                    throw new InvalidCastException("ElementBuilder ContentTypeFlag.Image contains non-image IContent");
                }

                if (imgContents.Any() == false)
                {
                    throw new InvalidCastException("ElementBuilder ContentTypeFlag.Image does not contain any image IContent");
                }

                BuildImageComponents(0,
                                     imgContents.Count,
                                     CorsFull.Left,
                                     CorsFull.Top,
                                     CorsFull.Right,
                                     CorsFull.Bottom,
                                     imgContents,
                                     components);
                break;

            case ContentTypeFlag.ImageAndRawText:
            case ContentTypeFlag.ImageAndHtml:
                if (txtContents.Any() == false)
                {
                    throw new InvalidCastException("ElementBuilder ContentTypeFlag.ImageAndText does not contain any text IContent");
                }

                if (imgContents.Any() == false)
                {
                    throw new InvalidCastException("ElementBuilder ContentTypeFlag.ImageAndText does not contain any image IContent");
                }

                BuildTextComponents(0,
                                    txtContents.Count,
                                    CorsVSplitLeft.Left,
                                    CorsVSplitLeft.Top,
                                    CorsVSplitLeft.Right,
                                    CorsVSplitLeft.Bottom,
                                    txtContents,
                                    components);

                BuildImageComponents(components.Count,
                                     imgContents.Count,
                                     CorsVSplitRight.Left,
                                     CorsVSplitRight.Top,
                                     CorsVSplitRight.Right,
                                     CorsVSplitRight.Bottom,
                                     imgContents,
                                     components);
                break;

            default:
                throw new NotImplementedException();
            }

            var compsText = components.Select(c => c.ToString())
                            .ToList();

            return(string.Format(ComponentsSkeleton,
                                 compsText.Count,
                                 string.Join("\n",
                                             compsText)));
        }
コード例 #40
0
 public void AddDataPair(string Title, string Content)
 {
     Titles.Add(Title);
     Contents.Add(Content);
 }
コード例 #41
0
ファイル: Hangi.cs プロジェクト: EasternCatNZL/RangisHangi
 void CreateInPit(Contents thing, int index)
 {
     GameObject pitObjectClone = Instantiate(pitObject, objectPos[index].position, Quaternion.identity);
 }
コード例 #42
0
ファイル: Token.cs プロジェクト: gitter-badger/NClap
 /// <summary>
 /// Converts the object into its own string object.
 /// </summary>
 /// <returns>The token, as a string.</returns>
 public override string ToString() => Contents.ToString();
コード例 #43
0
        public LateJoinGui()
        {
            IoCManager.InjectDependencies(this);

            Title = Loc.GetString("Late Join");

            var jobList = new VBoxContainer();
            var vBox    = new VBoxContainer
            {
                Children =
                {
                    new ScrollContainer
                    {
                        SizeFlagsVertical = SizeFlags.FillExpand,
                        Children          =
                        {
                            jobList
                        }
                    }
                }
            };

            Contents.AddChild(vBox);

            foreach (var job in _prototypeManager.EnumeratePrototypes <JobPrototype>().OrderBy(j => j.Name))
            {
                var jobButton = new JobButton
                {
                    JobId = job.ID
                };

                var jobSelector = new HBoxContainer
                {
                    SizeFlagsHorizontal = SizeFlags.FillExpand
                };

                var icon = new TextureRect
                {
                    TextureScale = (2, 2),
                    Stretch      = TextureRect.StretchMode.KeepCentered
                };

                if (job.Icon != null)
                {
                    var specifier = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Interface/Misc/job_icons.rsi"), job.Icon);
                    icon.Texture = specifier.Frame0();
                }
                jobSelector.AddChild(icon);

                var jobLabel = new Label
                {
                    Text = job.Name
                };

                jobSelector.AddChild(jobLabel);

                jobButton.AddChild(jobSelector);
                jobList.AddChild(jobButton);
                jobButton.OnPressed += args =>
                {
                    SelectedId?.Invoke(jobButton.JobId);
                };
            }

            SelectedId += jobId =>
            {
                Logger.InfoS("latejoin", $"Late joining as ID: {jobId}");
                _console.ProcessCommand($"joingame {CommandParsing.Escape(jobId)}");
                Close();
            };
        }
コード例 #44
0
ファイル: Token.cs プロジェクト: gitter-badger/NClap
 /// <summary>
 /// Checks for equality against another token.
 /// </summary>
 /// <param name="other">The other token.</param>
 /// <returns>True if the tokens are equal; false otherwise.
 /// </returns>
 public bool Equals(Token other)
 {
     return(Contents.Equals(other.Contents) && (StartsWithQuote == other.StartsWithQuote) && (EndsWithQuote == other.EndsWithQuote));
 }
コード例 #45
0
        private readonly Button[] _gameButtons = new Button[3]; //used to disable/enable all game buttons
        public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner)
        {
            MinSize = SetSize = (400, 200);
            Title   = Loc.GetString("Space Villain");
            Owner   = owner;

            var grid = new GridContainer {
                Columns = 1
            };

            var infoGrid = new GridContainer {
                Columns = 3
            };

            infoGrid.AddChild(new Label {
                Text = Loc.GetString("Player"), Align = Label.AlignMode.Center
            });
            infoGrid.AddChild(new Label {
                Text = "|", Align = Label.AlignMode.Center
            });
            _enemyNameLabel = new Label {
                Align = Label.AlignMode.Center
            };
            infoGrid.AddChild(_enemyNameLabel);

            _playerInfoLabel = new Label {
                Align = Label.AlignMode.Center
            };
            infoGrid.AddChild(_playerInfoLabel);
            infoGrid.AddChild(new Label {
                Text = "|", Align = Label.AlignMode.Center
            });
            _enemyInfoLabel = new Label {
                Align = Label.AlignMode.Center
            };
            infoGrid.AddChild(_enemyInfoLabel);
            var centerContainer = new CenterContainer();

            centerContainer.AddChild(infoGrid);
            grid.AddChild(centerContainer);

            _playerActionLabel = new Label {
                Align = Label.AlignMode.Center
            };
            grid.AddChild(_playerActionLabel);

            _enemyActionLabel = new Label {
                Align = Label.AlignMode.Center
            };
            grid.AddChild(_enemyActionLabel);

            var buttonGrid = new GridContainer {
                Columns = 3
            };

            _gameButtons[0] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Attack)
            {
                Text = Loc.GetString("ATTACK")
            };
            buttonGrid.AddChild(_gameButtons[0]);

            _gameButtons[1] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Heal)
            {
                Text = Loc.GetString("HEAL")
            };
            buttonGrid.AddChild(_gameButtons[1]);

            _gameButtons[2] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Recharge)
            {
                Text = Loc.GetString("RECHARGE")
            };
            buttonGrid.AddChild(_gameButtons[2]);

            centerContainer = new CenterContainer();
            centerContainer.AddChild(buttonGrid);
            grid.AddChild(centerContainer);

            var newGame = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.NewGame)
            {
                Text = Loc.GetString("New Game")
            };

            grid.AddChild(newGame);

            centerContainer = new CenterContainer();
            centerContainer.AddChild(grid);
            Contents.AddChild(centerContainer);
        }
コード例 #46
0
 public void Add(Contents item)
 {
     Add(item, null);
 }
コード例 #47
0
 public override Conditional GetContent()
 {
     Validate();
     return(Contents.FirstOrDefault(x => x.Condition()));
 }
コード例 #48
0
 public bool Contains(Contents item)
 {
     return(content.SelectMany(entry => entry.Value).Any(content => content.Id == item.Id));
 }
コード例 #49
0
 public void AddContent(PdfObject pdfObject)
 {
     Contents.Add(pdfObject);
     Dictionary["Contents"] = PdfArrayOfReferences();
 }
コード例 #50
0
 public override string ToString()
 {
     return(Contents.ToString());
 }
コード例 #51
0
 public override string ToString()
 {
     return(string.Concat(Contents.Select(x => x.Text)));
 }
コード例 #52
0
        public TutorialWindow()
        {
            Title = "The Tutorial!";

            //Get section header font
            var  cache        = IoCManager.Resolve <IResourceCache>();
            var  inputManager = IoCManager.Resolve <IInputManager>();
            Font headerFont   = new VectorFont(cache.GetResource <FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), _headerFontSize);

            var scrollContainer = new ScrollContainer();

            scrollContainer.AddChild(VBox = new VBoxContainer());
            Contents.AddChild(scrollContainer);

            //Intro
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = "Intro"
            });
            AddFormattedText(IntroContents);

            string Key(BoundKeyFunction func)
            {
                return(FormattedMessage.EscapeText(inputManager.GetKeyFunctionButtonString(func)));
            }

            //Controls
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = "\nControls"
            });

            // Moved this down here so that Rider shows which args correspond to which format spot.
            AddFormattedText(Loc.GetString(@"Movement: [color=#a4885c]{0} {1} {2} {3}[/color]
Switch hands: [color=#a4885c]{4}[/color]
Use held item: [color=#a4885c]{5}[/color]
Drop held item: [color=#a4885c]{6}[/color]
Smart equip from backpack: [color=#a4885c]{24}[/color]
Smart equip from belt: [color=#a4885c]{25}[/color]
Open inventory: [color=#a4885c]{7}[/color]
Open character window: [color=#a4885c]{8}[/color]
Open crafting window: [color=#a4885c]{9}[/color]
Open action menu: [color=#a4885c]{33}[/color]
Focus chat: [color=#a4885c]{10}[/color]
Focus OOC: [color=#a4885c]{26}[/color]
Focus Admin Chat: [color=#a4885c]{27}[/color]
Use hand/object in hand: [color=#a4885c]{22}[/color]
Do wide attack: [color=#a4885c]{23}[/color]
Use targeted entity: [color=#a4885c]{11}[/color]
Throw held item: [color=#a4885c]{12}[/color]
Pull entity: [color=#a4885c]{30}[/color]
Move pulled entity: [color=#a4885c]{29}[/color]
Stop pulling: [color=#a4885c]{32}[/color]
Examine entity: [color=#a4885c]{13}[/color]
Point somewhere: [color=#a4885c]{28}[/color]
Open entity context menu: [color=#a4885c]{14}[/color]
Toggle combat mode: [color=#a4885c]{15}[/color]
Toggle console: [color=#a4885c]{16}[/color]
Toggle UI: [color=#a4885c]{17}[/color]
Toggle debug overlay: [color=#a4885c]{18}[/color]
Toggle entity spawner: [color=#a4885c]{19}[/color]
Toggle tile spawner: [color=#a4885c]{20}[/color]
Toggle sandbox window: [color=#a4885c]{21}[/color]
Toggle admin menu [color=#a4885c]{31}[/color]
Hotbar slot 1: [color=#a4885c]{34}[/color]
Hotbar slot 2: [color=#a4885c]{35}[/color]
Hotbar slot 3: [color=#a4885c]{36}[/color]
Hotbar slot 4: [color=#a4885c]{37}[/color]
Hotbar slot 5: [color=#a4885c]{38}[/color]
Hotbar slot 6: [color=#a4885c]{39}[/color]
Hotbar slot 7: [color=#a4885c]{40}[/color]
Hotbar slot 8: [color=#a4885c]{41}[/color]
Hotbar slot 9: [color=#a4885c]{42}[/color]
Hotbar slot 0: [color=#a4885c]{43}[/color]
Hotbar Loadout 1: [color=#a4885c]{44}[/color]
Hotbar Loadout 2: [color=#a4885c]{45}[/color]
Hotbar Loadout 3: [color=#a4885c]{46}[/color]
Hotbar Loadout 4: [color=#a4885c]{47}[/color]
Hotbar Loadout 5: [color=#a4885c]{48}[/color]
Hotbar Loadout 6: [color=#a4885c]{49}[/color]
Hotbar Loadout 7: [color=#a4885c]{50}[/color]
Hotbar Loadout 8: [color=#a4885c]{51}[/color]
Hotbar Loadout 9: [color=#a4885c]{52}[/color]
                ",
                                           Key(MoveUp), Key(MoveLeft), Key(MoveDown), Key(MoveRight),
                                           Key(SwapHands),
                                           Key(ActivateItemInHand),
                                           Key(Drop),
                                           Key(OpenInventoryMenu),
                                           Key(OpenCharacterMenu),
                                           Key(OpenCraftingMenu),
                                           Key(FocusChat),
                                           Key(ActivateItemInWorld),
                                           Key(ThrowItemInHand),
                                           Key(ExamineEntity),
                                           Key(OpenContextMenu),
                                           Key(ToggleCombatMode),
                                           Key(ShowDebugConsole),
                                           Key(HideUI),
                                           Key(ShowDebugMonitors),
                                           Key(OpenEntitySpawnWindow),
                                           Key(OpenTileSpawnWindow),
                                           Key(OpenSandboxWindow),
                                           Key(Use),
                                           Key(WideAttack),
                                           Key(SmartEquipBackpack),
                                           Key(SmartEquipBelt),
                                           Key(FocusOOC),
                                           Key(FocusAdminChat),
                                           Key(Point),
                                           Key(TryPullObject),
                                           Key(MovePulledObject),
                                           Key(OpenAdminMenu),
                                           Key(ReleasePulledObject),
                                           Key(OpenActionsMenu),
                                           Key(Hotbar1),
                                           Key(Hotbar2),
                                           Key(Hotbar3),
                                           Key(Hotbar4),
                                           Key(Hotbar5),
                                           Key(Hotbar6),
                                           Key(Hotbar7),
                                           Key(Hotbar8),
                                           Key(Hotbar9),
                                           Key(Hotbar0),
                                           Key(Loadout1),
                                           Key(Loadout2),
                                           Key(Loadout3),
                                           Key(Loadout4),
                                           Key(Loadout5),
                                           Key(Loadout6),
                                           Key(Loadout7),
                                           Key(Loadout8),
                                           Key(Loadout9)));

            //Gameplay
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = "\nGameplay"
            });
            AddFormattedText(GameplayContents);

            //Gameplay
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = Loc.GetString("\nSandbox spawner", Key(OpenSandboxWindow))
            });
            AddFormattedText(SandboxSpawnerContents);

            //Feedback
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = "\nFeedback"
            });
            AddFormattedText(FeedbackContents);
        }
コード例 #53
0
        public ActionMenu(ClientActionsComponent actionsComponent, ActionsUI actionsUI)
        {
            _actionsComponent = actionsComponent;
            _actionsUI        = actionsUI;
            _actionManager    = IoCManager.Resolve <ActionManager>();
            _gameHud          = IoCManager.Resolve <IGameHud>();

            Title             = Loc.GetString("Actions");
            CustomMinimumSize = (300, 300);

            Contents.AddChild(new VBoxContainer
            {
                Children =
                {
                    new HBoxContainer
                    {
                        Children =
                        {
                            (_searchBar             = new LineEdit
                            {
                                StyleClasses        ={ StyleNano.StyleClassActionSearchBox                    },
                                SizeFlagsHorizontal = SizeFlags.FillExpand,
                                PlaceHolder         = Loc.GetString("Search")
                            }),
                            (_filterButton          = new MultiselectOptionButton <string>()
                            {
                                Label               = Loc.GetString("Filter")
                            }),
                        }
                    },
                    (_clearButton = new Button
                    {
                        Text = Loc.GetString("Clear"),
                    }),
                    (_filterLabel = new Label()),
                    new ScrollContainer
                    {
                        //TODO: needed? CustomMinimumSize = new Vector2(200.0f, 0.0f),
                        SizeFlagsVertical   = SizeFlags.FillExpand,
                        SizeFlagsHorizontal = SizeFlags.FillExpand,
                        Children            =
                        {
                            (_resultsGrid = new GridContainer
                            {
                                MaxWidth  = 300
                            })
                        }
                    }
                }
            });

            // populate filters from search tags
            var filterTags = new List <string>();

            foreach (var action in _actionManager.EnumerateActions())
            {
                filterTags.AddRange(action.Filters);
            }

            // special one to filter to only include item actions
            filterTags.Add(ItemTag);
            filterTags.Add(NotItemTag);
            filterTags.Add(InstantActionTag);
            filterTags.Add(ToggleActionTag);
            filterTags.Add(TargetActionTag);
            filterTags.Add(AllActionsTag);
            filterTags.Add(GrantedActionsTag);

            foreach (var tag in filterTags.Distinct().OrderBy(tag => tag))
            {
                _filterButton.AddItem(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(tag), tag);
            }

            UpdateFilterLabel();

            _dragShadow = new TextureRect
            {
                CustomMinimumSize = (64, 64),
                Stretch           = TextureRect.StretchMode.Scale,
                Visible           = false
            };
            UserInterfaceManager.PopupRoot.AddChild(_dragShadow);
            LayoutContainer.SetSize(_dragShadow, (64, 64));

            _dragDropHelper = new DragDropHelper <ActionMenuItem>(OnBeginActionDrag, OnContinueActionDrag, OnEndActionDrag);
        }
コード例 #54
0
ファイル: Renderer.cs プロジェクト: josuecorrea/DanfeSharp
   /**
     <summary>Renders the specified contents into an image context.</summary>
     <param name="contents">Source contents.</param>
     <param name="size">Image size expressed in device-space units (that is typically pixels).</param>
     <param name="area">Content area to render; <code>null</code> corresponds to the entire
      <see cref="IContentContext.Box">content bounding box</see>.</param>
     <returns>Image representing the rendered contents.</returns>
    */
   public Image Render(
 Contents contents,
 SizeF size,
 RectangleF? area
 )
   {
       return Render(contents.ContentContext, size, area);
   }
コード例 #55
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("ChatRoomAnnouncement");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (__isset.announcementSeq)
         {
             field.Name = "announcementSeq";
             field.Type = TType.I64;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             oprot.WriteI64(AnnouncementSeq);
             oprot.WriteFieldEnd();
         }
         if (__isset.type)
         {
             field.Name = "type";
             field.Type = TType.I32;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             oprot.WriteI32((int)Type);
             oprot.WriteFieldEnd();
         }
         if (Contents != null && __isset.contents)
         {
             field.Name = "contents";
             field.Type = TType.Struct;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             Contents.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (CreatorMid != null && __isset.creatorMid)
         {
             field.Name = "creatorMid";
             field.Type = TType.String;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(CreatorMid);
             oprot.WriteFieldEnd();
         }
         if (__isset.createdTime)
         {
             field.Name = "createdTime";
             field.Type = TType.I64;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             oprot.WriteI64(CreatedTime);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
コード例 #56
0
ファイル: Renderer.cs プロジェクト: josuecorrea/DanfeSharp
   /**
     <summary>Renders the specified contents into an image context.</summary>
     <param name="contents">Source contents.</param>
     <param name="size">Image size expressed in device-space units (that is typically pixels).</param>
     <returns>Image representing the rendered contents.</returns>
    */
   public Image Render(
 Contents contents,
 SizeF size
 )
   {
       return Render(contents, size, null);
   }
コード例 #57
0
        public ResearchConsoleMenu(ResearchConsoleBoundUserInterface owner = null)
        {
            IoCManager.InjectDependencies(this);

            Title = _localizationManager.GetString("R&D Console");

            Owner = owner;

            _unlockedTechnologies = new ItemList()
            {
                SelectMode          = ItemList.ItemListSelectMode.Button,
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SizeFlagsVertical   = SizeFlags.FillExpand,
            };

            _unlockedTechnologies.OnItemSelected += UnlockedTechnologySelected;

            _unlockableTechnologies = new ItemList()
            {
                SelectMode          = ItemList.ItemListSelectMode.Button,
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SizeFlagsVertical   = SizeFlags.FillExpand,
            };

            _unlockableTechnologies.OnItemSelected += UnlockableTechnologySelected;

            _futureTechnologies = new ItemList()
            {
                SelectMode          = ItemList.ItemListSelectMode.Button,
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SizeFlagsVertical   = SizeFlags.FillExpand,
            };

            _futureTechnologies.OnItemSelected += FutureTechnologySelected;

            var vbox = new VBoxContainer()
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SizeFlagsVertical   = SizeFlags.FillExpand,
            };

            var hboxTechnologies = new HBoxContainer()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 2,
                SeparationOverride    = 10,
            };

            var hboxSelected = new HBoxContainer()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1
            };

            var vboxPoints = new VBoxContainer()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1,
            };

            var vboxTechInfo = new VBoxContainer()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 3,
            };

            _pointLabel = new Label()
            {
                Text = _localizationManager.GetString("Research Points") + ": 0"
            };
            _pointsPerSecondLabel = new Label()
            {
                Text = _localizationManager.GetString("Points per Second") + ": 0"
            };

            var vboxPointsButtons = new VBoxContainer()
            {
                Align = BoxContainer.AlignMode.End,
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SizeFlagsVertical   = SizeFlags.FillExpand,
            };

            ServerSelectionButton = new Button()
            {
                Text = _localizationManager.GetString("Server list")
            };
            ServerSyncButton = new Button()
            {
                Text = _localizationManager.GetString("Sync")
            };
            UnlockButton = new Button()
            {
                Text = _localizationManager.GetString("Unlock"), Disabled = true
            };


            vboxPointsButtons.AddChild(ServerSelectionButton);
            vboxPointsButtons.AddChild(ServerSyncButton);
            vboxPointsButtons.AddChild(UnlockButton);

            vboxPoints.AddChild(_pointLabel);
            vboxPoints.AddChild(_pointsPerSecondLabel);
            vboxPoints.AddChild(vboxPointsButtons);

            _technologyIcon = new TextureRect()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1,
                Stretch = TextureRect.StretchMode.KeepAspectCentered,
            };
            _technologyName         = new Label();
            _technologyDescription  = new Label();
            _technologyRequirements = new Label();

            vboxTechInfo.AddChild(_technologyName);
            vboxTechInfo.AddChild(_technologyDescription);
            vboxTechInfo.AddChild(_technologyRequirements);

            hboxSelected.AddChild(_technologyIcon);
            hboxSelected.AddChild(vboxTechInfo);
            hboxSelected.AddChild(vboxPoints);

            hboxTechnologies.AddChild(_unlockedTechnologies);
            hboxTechnologies.AddChild(_unlockableTechnologies);
            hboxTechnologies.AddChild(_futureTechnologies);

            vbox.AddChild(hboxTechnologies);
            vbox.AddChild(hboxSelected);

            Contents.AddChild(vbox);

            UnlockButton.OnPressed += (args) =>
            {
                CleanSelectedTechnology();
            };

            Populate();
        }
コード例 #58
0
ファイル: winMain.cs プロジェクト: hmxiaoxiao/leo
        // 树右键菜单的更新
        private void menuTreeUpdate_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode == null)
                return;

            string id = treeView1.SelectedNode.Tag.ToString();
            Contents c = new Contents();
            Sasac web = new Sasac();

            web.FindedLink += c.SaveContents;
            c.SavedLink += AddTreeNodeTipGridLine;

            web.UpdatePages(int.Parse(treeView1.SelectedNode.Name));
            MessageBox.Show("更新完成");
        }
        private void Draw(Rect position, SerializedProperty property)
        {
            SerializedProperty category      = Properties.Get(PropertyName.Category, property);
            SerializedProperty name          = Properties.Get(PropertyName.Name, property);
            SerializedProperty instantAction = Properties.Get(PropertyName.InstantAction, property);

            var items = new List <string>();

            Color initialColor = GUI.color; //save the GUI color

            NumberOfLines[property.propertyPath] = 1;
            Rect drawRect = GetDrawRect(position); //calculate draw rect

            GUI.color = DGUI.Colors.PropertyColor(DrawerColorName);

            float x     = drawRect.x + DGUI.Properties.Space(2);
            float width = drawRect.width
                          - DGUI.Toggle.Switch.Width
                          - Contents.GetWidth(UILabels.InstantAction, DGUI.Label.Style(Size.S))
                          - DGUI.Properties.Space(9);


            //LINE 1
            drawRect.y += DGUI.Properties.StandardVerticalSpacing;

            //VIEW CATEGORY
            int categorySelectedIndex = Database.CategoryNames.Contains(category.stringValue)
                ? Database.CategoryNames.IndexOf(category.stringValue)
                : Database.CategoryNames.IndexOf(NamesDatabase.CUSTOM);

            EditorGUI.BeginChangeCheck();
            categorySelectedIndex = EditorGUI.Popup(new Rect(x, drawRect.y + 1, width * 0.5f, drawRect.height), categorySelectedIndex, Database.CategoryNames.ToArray());
            x += width * 0.5f + DGUI.Properties.Space();

            if (EditorGUI.EndChangeCheck())
            {
                category.stringValue = Database.CategoryNames[categorySelectedIndex];
                if (Database.CategoryNames[categorySelectedIndex] != NamesDatabase.CUSTOM)
                {
                    if (string.IsNullOrEmpty(name.stringValue.Trim()))
                    {
                        name.stringValue = Database.GetNamesList(Database.CategoryNames[categorySelectedIndex])[0];
                    }
                    else if (name.stringValue.Trim() != NamesDatabase.UNNAMED &&
                             !Database.GetNamesList(Database.CategoryNames[categorySelectedIndex]).Contains(name.stringValue.Trim()))
                    {
                        if (EditorUtility.DisplayDialog("Add Name", "Add the '" + name.stringValue.Trim() + "' name to the '" + Database.CategoryNames[categorySelectedIndex] + "' category?", "Yes", "No"))
                        {
                            string      cleanName     = name.stringValue.Trim();
                            ListOfNames categoryAsset = Database.GetCategory(Database.CategoryNames[categorySelectedIndex]);
                            categoryAsset.Names.Add(cleanName);
                            categoryAsset.SetDirty(false);
                            Database.Sort(false, true);
//                            Database.GetNamesList(Database.CategoryNames[categorySelectedIndex], true).Add(name.stringValue.Trim());
//                            Database.SetDirty(true);
                        }
                        else if (Database.CategoryNames[categorySelectedIndex] == NamesDatabase.GENERAL)
                        {
                            name.stringValue = NamesDatabase.UNNAMED;
                        }
                        else
                        {
                            name.stringValue = Database.GetNamesList(Database.CategoryNames[categorySelectedIndex])[0];
                        }
                    }
                }
            }

            bool hasCustomName = category.stringValue.Equals(NamesDatabase.CUSTOM);

            if (!Database.Contains(category.stringValue)) //database does not contain this category -> reset it to custom
            {
                hasCustomName        = true;
                category.stringValue = NamesDatabase.CUSTOM;
            }

            //VIEW NAME
            if (!hasCustomName)
            {
                items = Database.GetNamesList(category.stringValue);
                if (items.Count == 0)
                {
                    if (!Database.GetNamesList(NamesDatabase.GENERAL, true).Contains(NamesDatabase.UNNAMED))
                    {
                        Database.GetNamesList(NamesDatabase.GENERAL, true).Add(NamesDatabase.UNNAMED);
                        Database.SetDirty(true);
                    }

                    category.stringValue = NamesDatabase.GENERAL;
                    items = Database.GetNamesList(category.stringValue);
                }
            }

            if (hasCustomName)
            {
                EditorGUI.PropertyField(new Rect(x, drawRect.y + 1, width * 0.5f, drawRect.height), name, GUIContent.none, true);
            }
            else
            {
                int nameSelectedIndex = 0;
                if (items.Contains(name.stringValue))
                {
                    nameSelectedIndex = items.IndexOf(name.stringValue);
                }
                else
                {
                    if (category.stringValue.Equals(NamesDatabase.GENERAL))
                    {
                        name.stringValue  = NamesDatabase.UNNAMED;
                        nameSelectedIndex = items.IndexOf(NamesDatabase.UNNAMED);
                    }
                    else if (name.stringValue != NamesDatabase.UNNAMED &&
                             EditorUtility.DisplayDialog("Add Name", "Add the '" + name.stringValue + "' name to the '" + category.stringValue + "' category?", "Yes", "No"))
                    {
                        string cleanName = name.stringValue.Trim();
                        if (string.IsNullOrEmpty(cleanName))
                        {
                            name.stringValue = items[nameSelectedIndex];
                        }
                        else if (items.Contains(cleanName))
                        {
                            name.stringValue  = cleanName;
                            nameSelectedIndex = items.IndexOf(cleanName);
                        }
                        else
                        {
                            ListOfNames categoryAsset = Database.GetCategory(category.stringValue);
                            categoryAsset.Names.Add(cleanName);
                            categoryAsset.SetDirty(false);
                            Database.Sort(false, true);
//                            Database.GetNamesList(category.stringValue, true).Add(cleanName);
//                            Database.SetDirty(true);
                            name.stringValue  = cleanName;
                            nameSelectedIndex = items.IndexOf(name.stringValue);
                        }
                    }
                    else
                    {
                        name.stringValue = items[nameSelectedIndex];
                    }
                }

                EditorGUI.BeginChangeCheck();
                nameSelectedIndex = EditorGUI.Popup(new Rect(x, drawRect.y + 1, width * 0.5f, drawRect.height), nameSelectedIndex, items.ToArray());
                if (EditorGUI.EndChangeCheck())
                {
                    name.stringValue = items[nameSelectedIndex];
                }
            }

            x += width * 0.5f + DGUI.Properties.Space();

            GUI.color = initialColor; //restore the GUI color
            DGUI.Toggle.Switch.Draw(new Rect(x, drawRect.y + 1, DGUI.Toggle.Switch.Width, drawRect.height), instantAction, DrawerColorName);
            x += DGUI.Toggle.Switch.Width + DGUI.Properties.Space();

            GUI.color = GUI.color.WithAlpha(DGUI.Properties.TextIconAlphaValue(instantAction.boolValue));
            DGUI.Label.Draw(new Rect(x, drawRect.y, Contents.GetWidth(UILabels.InstantAction), drawRect.height), UILabels.InstantAction, Size.S, instantAction.boolValue ? DrawerColorName : DGUI.Colors.DisabledTextColorName);
            GUI.color = initialColor; //restore the GUI color
        }
コード例 #60
0
 /**
  * Copy constructor
  *
  * @param copy the contents to copy
  */
 public Contents(Contents copy)
     : base(copy)
 {
 }