コード例 #1
0
ファイル: Order.cs プロジェクト: Leucetius/MD2-Source
 public Order(AssemblyLine line, OrderConfig config)
 {
     this.shoppingList = new ShoppingList(this);
     this.line = line;
     this.SetConfigDirect(config);
     this.TicksToFinish = Config.WorkAmount;
 }
コード例 #2
0
 public Order(AssemblyLine line, OrderConfig config)
 {
     this.shoppingList = new ShoppingList(this);
     this.line         = line;
     this.SetConfigDirect(config);
     this.TicksToFinish = Config.WorkAmount;
 }
コード例 #3
0
 public Window_RecipeManagement(AssemblyLine line, Window_LineManagementUI previousPage)
     : base(line, "RecipeManagementHelp".Translate())
 {
     this.previousPage = previousPage;
     if (recipesList != null)
     {
         recipesList.Sort((o, y) => o.label.CompareTo(y.label));
         selectedDef = recipesList.First();
         config      = new OrderConfig(selectedDef);
     }
 }
コード例 #4
0
 public Window_RecipeManagement(AssemblyLine line, Window_LineManagementUI previousPage)
     : base(line, "RecipeManagementHelp".Translate())
 {
     this.previousPage = previousPage;
     if (recipesList != null)
     {
         recipesList.Sort((o, y) => o.label.CompareTo(y.label));
         selectedDef = recipesList.First();
         config = new OrderConfig(selectedDef);
     }
 }
コード例 #5
0
ファイル: Order.cs プロジェクト: Leucetius/MD2-Source
 public void SetConfigDirect(OrderConfig config)
 {
     this.config = config;
     config.SetParentDirect(this);
 }
コード例 #6
0
 public void SetConfigDirect(OrderConfig config)
 {
     this.config = config;
     config.SetParentDirect(this);
 }
コード例 #7
0
        private void DrawRecipeList(Rect inRect)
        {
            Rect availableRecipeMainRect = new Rect(0f, currentYMaxLeft, availableRecipeMainRectSize.x, availableRecipeMainRectSize.y);

            this.bottom              = availableRecipeMainRect.yMax;
            this.recipeEntrySize     = new Vector2(availableRecipeMainRect.width - 16f, 48f);
            this.recipeAddButtonSize = new Vector2(120f, this.recipeEntrySize.y - 12f);

            Widgets.DrawMenuSection(availableRecipeMainRect);

            GUI.BeginGroup(availableRecipeMainRect);

            if (enteredText != "")
            {
                list = (
                    from t in this.recipesList
                    where t.label.ToLower().Contains(enteredText.ToLower())
                    select t).ToList();
            }
            else
            {
                list = this.recipesList;
            }
            float entryHeight = this.recipeEntrySize.y;

            float height = (float)list.Count * entryHeight;

            Rect viewRect = new Rect(0f, 0f, availableRecipeMainRect.width - 16f, height);
            Rect outRect  = new Rect(availableRecipeMainRect.AtZero());

            Widgets.BeginScrollView(outRect, ref this.scrollPosition, viewRect);

            float currentY = 0f;
            float num3     = 0f;

            if (recipesList.Count == 0)
            {
                Rect rect = new Rect(0f, currentY, this.recipeEntrySize.x, this.recipeEntrySize.y);
                Text.Font = GameFont.Small;
                Widgets.Label(rect, "NoRecipesFound".Translate());
            }
            else
            {
                foreach (RecipeDef def in list)
                {
                    Rect rect2 = new Rect(0f, currentY, this.recipeEntrySize.x, this.recipeEntrySize.y);
                    if ((rect2.Contains(Event.current.mousePosition)) || (selectedDef != null && def == selectedDef))
                    {
                        GUI.color = MouseHoverColor;
                        GUI.DrawTexture(rect2, BaseContent.WhiteTex);
                    }
                    else if (num3 % 2 == 0)
                    {
                        GUI.DrawTexture(rect2, AltTexture);
                    }
                    Rect innerRect = rect2.ContractedBy(3f);
                    GUI.BeginGroup(innerRect);
                    string recipeName = def.label.CapitalizeFirst();
                    GUI.color   = Color.white;
                    Text.Font   = GameFont.Small;
                    Text.Anchor = TextAnchor.MiddleLeft;
                    Rect rect = new Rect(15f, 0f, innerRect.width, innerRect.height);
                    Widgets.Label(rect, recipeName);
                    float buttonX = recipeEntrySize.x - 6f - recipeAddButtonSize.x;
                    Rect  butRect = new Rect(buttonX, 0f, recipeAddButtonSize.x, recipeAddButtonSize.y);
                    if (Widgets.InvisibleButton(rect))
                    {
                        this.selectedDef = def;
                        this.config      = new OrderConfig(def);
                        //Log.Message("Clicked " + def.defName);
                    }
                    GUI.EndGroup();
                    currentY += entryHeight;
                    num3++;
                }
            }
            GUI.EndGroup();
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.EndScrollView();
        }
コード例 #8
0
        private void DrawRecipeList(Rect inRect)
        {
            Rect availableRecipeMainRect = new Rect(0f, currentYMaxLeft, availableRecipeMainRectSize.x, availableRecipeMainRectSize.y);
            this.bottom = availableRecipeMainRect.yMax;
            this.recipeEntrySize = new Vector2(availableRecipeMainRect.width - 16f, 48f);
            this.recipeAddButtonSize = new Vector2(120f, this.recipeEntrySize.y - 12f);

            Widgets.DrawMenuSection(availableRecipeMainRect);

            GUI.BeginGroup(availableRecipeMainRect);

            if (enteredText != "")
            {
                list = (
                    from t in this.recipesList
                    where t.label.ToLower().Contains(enteredText.ToLower())
                    select t).ToList();
            }
            else
            {
                list = this.recipesList;
            }
            float entryHeight = this.recipeEntrySize.y;

            float height = (float)list.Count * entryHeight;

            Rect viewRect = new Rect(0f, 0f, availableRecipeMainRect.width - 16f, height);
            Rect outRect = new Rect(availableRecipeMainRect.AtZero());

            Widgets.BeginScrollView(outRect, ref this.scrollPosition, viewRect);

            float currentY = 0f;
            float num3 = 0f;
            if (recipesList.Count == 0)
            {
                Rect rect = new Rect(0f, currentY, this.recipeEntrySize.x, this.recipeEntrySize.y);
                Text.Font = GameFont.Small;
                Widgets.Label(rect, "NoRecipesFound".Translate());
            }
            else
            {
                foreach (RecipeDef def in list)
                {
                    Rect rect2 = new Rect(0f, currentY, this.recipeEntrySize.x, this.recipeEntrySize.y);
                    if ((rect2.Contains(Event.current.mousePosition)) || (selectedDef != null && def == selectedDef))
                    {
                        GUI.color = MouseHoverColor;
                        GUI.DrawTexture(rect2, BaseContent.WhiteTex);
                    }
                    else if (num3 % 2 == 0)
                    {
                        GUI.DrawTexture(rect2, AltTexture);
                    }
                    Rect innerRect = rect2.ContractedBy(3f);
                    GUI.BeginGroup(innerRect);
                    string recipeName = def.label.CapitalizeFirst();
                    GUI.color = Color.white;
                    Text.Font = GameFont.Small;
                    Text.Anchor = TextAnchor.MiddleLeft;
                    Rect rect = new Rect(15f, 0f, innerRect.width, innerRect.height);
                    Widgets.Label(rect, recipeName);
                    float buttonX = recipeEntrySize.x - 6f - recipeAddButtonSize.x;
                    Rect butRect = new Rect(buttonX, 0f, recipeAddButtonSize.x, recipeAddButtonSize.y);
                    if (Widgets.InvisibleButton(rect))
                    {
                        this.selectedDef = def;
                        this.config = new OrderConfig(def);
                        //Log.Message("Clicked " + def.defName);
                    }
                    GUI.EndGroup();
                    currentY += entryHeight;
                    num3++;
                }
            }
            GUI.EndGroup();
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.EndScrollView();
        }