Пример #1
0
        public override void ShowLexicon(PanelBuilder panel)
        {
            base.ShowLexicon(panel);

            panel.AddSubLabel("Author", author);
            panel.AddSubLabel("Level", level);
            panel.AddSubLabel("Size", $"{width}x{height}");
            if (S.Debug())
            {
                panel.AddLabel("Folder: " + folder);
            }
            req.BuildPanel(panel, null);

            if (Intern())
            {
                panel.AddHeaderLabel("Overview");
                panel.AddImage(UnityEngine.Resources.Load <Sprite>(folder.Substring(1) + "/" + id));
            }
            else
            {
                FileInfo img = new FileInfo(Dir() + id + ".png");
                if (img.Exists)
                {
                    panel.AddHeaderLabel("Overview");
                    panel.AddImage(SpriteHelper.LoadExternalSprite(img.FullName));
                }
            }
        }
Пример #2
0
        public override void ShowDetail(PanelBuilder panel)
        {
            panel.AddHeaderLabel("General");
            LSys.tem.inputs.GetAllByCategory("general").ForEach(i => i.BuildPanel(panel));

            panel.AddHeaderLabel("Actions");
            LSys.tem.inputs.GetAllByCategory("unit").ForEach(i => i.BuildPanel(panel));

            panel.AddHeaderLabel("Camera");
            LSys.tem.inputs.GetAllByCategory("camera").ForEach(i => i.BuildPanel(panel));
        }
Пример #3
0
        public override void ShowDetail(PanelBuilder panel)
        {
            PlayerResearchMgmt mgmt = S.ActPlayer().research;

            panel.AddHeaderLabel("Actual");
            if (mgmt.actual == null || mgmt.actual.Count == 0)
            {
                panel.AddImageLabel("No Research at the moment", "no");
            }
            else
            {
                foreach (string e in mgmt.actual)
                {
                    Element el = L.b.elements[e];
                    panel.AddImageLabel(el.Name(), el.Icon);
                }
            }

            elements = new List <string>();

            panel.AddHeaderLabel("New Research area");
            foreach (string en in S.ActPlayer().elements.elements)
            {
                Element e = L.b.elements[en];
                panel.AddImageTextButton($"Add {e.Name()}", e.Sprite(), (() =>
                {
                    elements.Add(e.id);
                    UpdateDesc();
                }));
            }

            panel.AddHeaderLabel("Control");
            desc = panel.AddLabel("???? ???? ???? ???? ???? ???? ???? ???? ???? ???? ???? ???? ");
            panel.AddButton("Clear actual plan", () => { elements.Clear(); UpdateDesc(); });
            start = panel.AddButton("??", () => { mgmt.BeginNewResearch(elements); window.CloseWindow(); });
            UpdateDesc();

            if (S.Debug())
            {
                panel.AddSubLabel($"Act cost", S.ActPlayer().research.cost.ToString());
                panel.AddHeaderLabel("General possible");
                panel.AddLabel(String.Join(",", S.ActPlayer().research.AvailableResearch().Select(r => r.Name())));
                if (mgmt.actual != null)
                {
                    panel.AddHeaderLabel("Actual possible");
                    panel.AddLabel(String.Join(",", S.ActPlayer().research.AvailableResearch(mgmt.actual).Select(r => r.Name())));
                }
            }
        }
Пример #4
0
        public override void ShowDetail(PanelBuilder panel)
        {
            panel.AddImageLabel(_info.name, _info.Sprite());
            panel.AddHeaderLabel("Information");
            //diff unit?
            if (!_info.Owner(S.ActPlayerID()))
            {
                panel.AddSubLabel("Owner", _info.Player().name, _info.Player().Coat().Icon);
                panel.AddSubLabel("HP", $"??/{_info.baseData.hp}", "hp");
                panel.AddSubLabel("AP", $"??/{_info.baseData.ap}", "ap");
                return;
            }

            panel.RichText(_info.data.info.LastInfo());
            panel.AddSubLabel("HP", $"{_info.data.hp}/{_info.data.hpMax}", "hp");
            panel.AddSubLabel("AP", $"{_info.data.ap}/{_info.data.apMax}", "ap");

            Construction con = _info.GetComponent <Construction>();

            if (con != null)
            {
                panel.AddResT("constructionOnGoing", _info.data.construction.ToDictionary(entry => entry.Key, entry => entry.Value));
                panel.AddLabelT("constructionOnGoingDesc");
            }

            panel.AddModi(_info.data.modi);
        }
Пример #5
0
        public override void ShowDetail(PanelBuilder panel)
        {
            base.ShowDetail(panel);
            //show cost differences
            panel.AddHeaderLabel("Real cost");
            bool found = false;

            foreach (var cost in build.cost)
            {
                var r = L.b.res[cost.Key];
                if (!go.baseData.cost.ContainsKey(cost.Key))
                {
                    r.AddImageLabel(panel, cost.Value);
                    found = true;
                    continue;
                }

                if (cost.Value > go.baseData.cost[cost.Key])
                {
                    r.AddImageLabel(panel, cost.Value - go.baseData.cost[cost.Key]);
                    found = true;
                }
            }

            if (!found)
            {
                panel.AddLabel("No extra cost");
            }
        }
Пример #6
0
        public void ShowRes(PanelBuilder panel, Player player, NVector pos)
        {
            //addHeader
            if (pos != null && GameMgmt.Get().data.map.levels[pos.level].ResGenKey(pos.x, pos.y) != null && player != null && player.overlay.Get("res", pos) == 1)
            {
                panel.AddHeaderLabelT("res");
                foreach (string key in GameMgmt.Get().data.map.levels[pos.level].ResGenKey(pos.x, pos.y))
                {
                    if (S.Debug())
                    {
                        panel.AddHeaderLabel(key);
                        panel.AddInput(key, GameMgmt.Get().data.map.ResGen(pos, key),
                                       val => GameMgmt.Get().data.map.ResGenAdd(pos, key, val - GameMgmt.Get().data.map.ResGen(pos, key)));
                        continue;
                    }
                    L.b.res[key].AddImageLabel(panel, L.b.terrains.GenDesc(GameMgmt.Get().data.map.ResGen(pos, key)));
                }
                return;
            }

            if (res.Count > 0)
            {
                panel.AddHeaderLabelT("resInclude");
                foreach (KeyValuePair <string, string> r in res)
                {
                    int    chance = ResChance(r.Key);
                    var    c      = ResRange(r.Key);
                    string txt    = S.T("resCountRange", L.b.terrains.GenDesc(c.min), L.b.terrains.GenDesc(c.max));
                    L.b.res[r.Key].AddImageLabel(panel, chance >= 1 ? S.T("resCountChance", chance, txt) : txt);
                }
            }
        }
Пример #7
0
        public override void ShowDetail(PanelBuilder panel)
        {
            panel.AddHeaderLabel("Receipts");

            int  i     = 0;
            bool found = false;

            while (_holder.data.ContainsKey("craft" + i))
            {
                found = true;
                var    d  = SplitHelper.SplitInt(_holder.data["craft" + i]);
                Craft  c  = L.b.crafts[d.key];
                int    id = i;
                Button b  = panel.AddImageTextButton((d.value == -1?"Endless ":d.value + "x ") + c.Name(), c.Icon, () =>
                {
                    Remove(id);
                });

                i++;
            }

            if (!found)
            {
                panel.AddLabel("No active receipt found. You can add some from the left menu.");
            }
        }
Пример #8
0
        public void BuildPanel(PanelBuilder panel, string title, Player player = null)
        {
            try
            {
                //addHeader
                if (reqs.Count == 0)
                {
                    return;
                }

                panel.AddHeaderLabel(title);

                //add req
                foreach (var req in reqs)
                {
                    BaseReq r = OLib.GetReq(req[0]);
                    if (player == null)
                    {
                        panel.AddLabel(r.Desc(null, req[1]));
                    }
                    else
                    {
                        panel.AddImageLabel(r.Desc(player, req[1]), r.Check(player, req[1]));
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionHelper.ShowException(e);
            }
        }
        public override void ShowDetail(PanelBuilder panel)
        {
            panel.AddSubLabel("Position", _mapElementInfo.Pos().ToString());
            panel.AddHeaderLabel("HP");
            panel.AddInput("HP", _mapElementInfo.data.hp, (s => { _mapElementInfo.data.hp = s; }));
            panel.AddHeaderLabel("AP");
            panel.AddInput("AP", _mapElementInfo.data.ap, (s => { _mapElementInfo.data.ap = s; }));
            panel.AddButton("Set Finish", _mapElementInfo.FinishConstruct);

            //display all actions
            foreach (var act in _mapElementInfo.data.action.actions)
            {
                act.PerformAction().BuildPanel(new ActionDisplaySettings(panel, _mapElementInfo.Player(), _mapElementInfo, _mapElementInfo.Pos(), act));
            }

            //display modis
        }
Пример #10
0
        public override void ShowDetail(PanelBuilder panel)
        {
            _build.AddImageLabel(panel);
            panel.AddResT("constructionCost", _cost);
            panel.AddHeaderLabelT("general");
            var hpap = CalculatedData.Calc(_build, _cost);

            panel.AddSubLabelT("hp", hpap.hp, "hp");
            panel.AddSubLabelT("ap", hpap.ap, "ap");
            var b = L.b.modifiers[C.BuildRes].CalcText(hpap.buildTime, S.ActPlayer(), pos);

            L.b.res[C.BuildRes].AddSubLabel(panel, b.value, "round", b.display);

            panel.AddButtonT("reset", (() =>
            {
                _cost = new Dictionary <string, int>(_costOrg);
                ReCalc(0);
            }));

            //what replace?
            if (!_cost.ContainsKey(replace.id))
            {
                panel.AddLabel(S.T("constructionOwnReplaceNothing", _build.Name()));
                return;
            }

            panel.AddHeaderLabel(S.T("constructionOwnReplace", replace.Text(_cost[replace.id])));

            //build dropdown
            List <string> values = new List <string>();
            List <string> titles = new List <string>();

            foreach (Resource r in L.b.res.GetAllByCategory(replace.id))
            {
                if (r.special == false && _town.KnowRes(r.id))
                {
                    values.Add(r.id);
                    titles.Add(r.Text(_town.GetRes(r.id)));
                }
            }

            panel.AddDropdown(values.ToArray(), values[0], titles.ToArray(), s =>
            {
                selected = L.b.res[s];
                UpdateButton();
            });

            _one = panel.AddImageTextButton("", "logo", () => { ReCalc(1); });

            _ten = panel.AddImageTextButton("", "logo", () => { ReCalc(10); });

            max = panel.AddImageTextButton("", "logo", () => { ReCalc(Math.Min(_cost[replace.id], _town.GetRes(selected.id))); });

            total = panel.AddImageTextButton("", "logo", () => { ReCalc(_cost[replace.id]); });

            selected = L.b.res[values[0]];
            UpdateButton();
        }
Пример #11
0
        public override void ShowDetail(PanelBuilder panel)
        {
            panel.AddHeaderLabel("General");
            panel.AddSubLabel("Version", Application.version);
            panel.AddSubLabel("System", Application.platform.ToString());

            panel.AddHeaderLabel("Library");
            foreach (var m in L.b.mgmts.Values)
            {
                panel.AddImageLabel($"{m.Length} x {m.Name()}", m.Sprite());
            }

            panel.AddHeaderLabel("Mods");
            foreach (var mod in ModManager.GetInstalledModDirectories(true))
            {
                panel.AddLabel(new DirectoryInfo(mod).Name);
            }
        }
Пример #12
0
 public override void ShowLexicon(PanelBuilder panel)
 {
     base.ShowLexicon(panel);
     foreach (var k in trans)
     {
         panel.AddHeaderLabel(k.Key);
         panel.AddLabel(k.Value);
     }
 }
Пример #13
0
 public void ShowInfo(PanelBuilder panel)
 {
     panel.AddHeaderLabel(name);
     panel.AddSubLabel("Round", round, "round");
     panel.AddSubLabel("Date", date.ToLongDateString(), "!Icons/fugue:date");
     panel.AddSubLabel("Game", version, "logo");
     if (S.Debug())
     {
         panel.AddSubLabel("File", file, "file");
     }
 }
Пример #14
0
 public void ShowDetail(PanelBuilder panel)
 {
     base.ShowLexicon(panel);
     panel.AddHeaderLabel("Scenarios");
     foreach (Scenario s in Scenarios())
     {
         if (s.req.Check(null))
         {
             panel.AddImageTextButton(s.Name(), SpriteHelper.Load(s.Icon), (() => s.Start()));
         }
     }
 }
Пример #15
0
 public override void ShowLexicon(PanelBuilder panel)
 {
     base.ShowLexicon(panel);
     panel.AddSubLabel("Daytime", daytime);
     panel.AddSubLabel("Season", season);
     panel.AddModi(modi);
     if (S.IsGame())
     {
         panel.AddHeaderLabel("Actual");
         panel.AddLabel(GameMgmt.Get().gameRound.GetRoundString());
     }
 }
Пример #16
0
        public void AddOption(PanelBuilder panel)
        {
            if (type == "bool")
            {
                panel.AddCheckbox(Bool(), Name(), s => { SetValue(Convert.ToString(s)); });
                return;
            }

            if (type.StartsWith("scale"))
            {
                panel.AddHeaderLabel(Name());
                var t = SplitHelper.SeparatorInt(SplitHelper.Delimiter(type).value);
                panel.AddSlider(t[0], t[1], PlayerPrefs.GetInt(id, Int32.Parse(Value())), s =>
                {
                    SetValue(s.ToString());
                });
                return;
            }

            if (type == "text")
            {
                panel.AddInput(Name(), Value(), SetValue);
            }

            if (type.StartsWith("dropdown"))
            {
                var           values = SplitHelper.Separator(SplitHelper.Delimiter(type).value);
                List <string> titles = new List <string>();
                foreach (var value in values)
                {
                    titles.Add(S.T(value));
                }
                panel.AddHeaderLabel(Name());
                panel.AddDropdown(values, Value(), titles.ToArray(), SetValue);
            }
        }
Пример #17
0
        public override void ShowDetail(PanelBuilder panel)
        {
            panel.AddHeaderLabel("Finish researches");
            foreach (Research r in L.b.researches.Values())
            {
                if (S.ActPlayer().research.IsFinish(r.id))
                {
                    panel.AddImageLabel(r.Name(), r.Icon);
                }
            }

            if (panel.Count() == 1)
            {
                panel.AddImageLabel("No finish research.", "no");
            }
        }
Пример #18
0
        public override void ShowDetail(PanelBuilder panel)
        {
            base.ShowDetail(panel);
            panel.AddButton($"Show details for {town.name}", (() => town.ShowDetails()));

            panel.AddHeaderLabel("Buildings");
            //add buildings
            foreach (BuildingInfo info in GameMgmt.Get().building.GetByTown(town.id))
            {
                panel.AddImageTextButton(info.name, info.baseData.Sprite(), () =>
                {
                    S.CameraMove().MoveTo(info.Pos());
                    OnMapUI.Get().UpdatePanel(info.Pos());
                    b.CloseWindow();
                });
            }
        }
Пример #19
0
        public override void ShowDetail(PanelBuilder panel)
        {
            int lastRound = -1;

            //show all
            foreach (Info key in _infoMgmt.infos)
            {
                //new round?
                if (key.round != lastRound)
                {
                    lastRound = key.round;
                    panel.AddHeaderLabel(S.Round().GetRoundString(key.round));
                }

                key.AddToPanel(panel);
            }
        }
Пример #20
0
        public override void ShowLexicon(PanelBuilder panel)
        {
            DataTerrain terr = L.b.terrains[Terrain];

            base.ShowLexicon(panel);
            panel.AddHeaderLabelT("general");
            panel.AddImageLabel($"Home terrain: {terr.Name()}", terr.Sprite());
            panel.AddModi(Modi);
            if (elements.Count > 0)
            {
                panel.AddHeaderLabel(S.T(L.b.elements.Id(), elements.Count));
                foreach (var element in elements)
                {
                    L.b.elements[element].AddImageLabel(panel);
                }
            }
        }
Пример #21
0
        private void ShowInhabitants(PanelBuilder panel)
        {
            var n   = town.MaxInhabitantsAndWorker();
            int inh = town.GetRes(C.Inhabitant);

            panel.AddHeaderLabelT("general");
            L.b.res[C.Worker].AddSubLabel(panel, town.GetRes(C.Worker), "free worker");
            if (!L.b.gameOptions["inhabitantGrow"].Bool())
            {
                L.b.res[C.Inhabitant].AddImageLabel(panel, inh);
            }
            else
            {
                L.b.res[C.Inhabitant].AddImageLabel(panel, $"{inh}/{n.maxInhabitants}");
                panel.AddHeaderLabel("Growth");
                L.b.res[C.Worker].AddSubLabel(panel, town.level, "per round");
            }
        }
Пример #22
0
        public override void ShowDetail(PanelBuilder panel)
        {
            _craft.ShowLexicon(panel);
            _craft.req.BuildPanel(panel, _info, _info.Pos());

            panel.AddHeaderLabel("Actions");
            panel.AddImageTextButton(_craft.Name(), _craft.Icon, () =>
                                     _holder.data["craft" + NextFreeID()] = $"{_craft.id}:1"
                                     );
            panel.AddImageTextButton($"10x {_craft.Name()}", _craft.Icon, () =>
                                     _holder.data["craft" + NextFreeID()] = $"{_craft.id}:10"
                                     );
            panel.AddImageTextButton($"100x {_craft.Name()}", _craft.Icon, () =>
                                     _holder.data["craft" + NextFreeID()] = $"{_craft.id}:100"
                                     );
            panel.AddImageTextButton($"endless {_craft.Name()}", _craft.Icon, () =>
                                     _holder.data["craft" + NextFreeID()] = $"{_craft.id}:-1"
                                     );
        }
Пример #23
0
        public override void ShowDetail(PanelBuilder panel)
        {
            panel.AddButton("Add a new player", () =>
            {
                startConfig[id + "name"]      = id == 0?System.Environment.UserName:"******";
                startConfig[id + "coat"]      = L.b.coats.Auto(id);
                startConfig[id + "nation"]    = "north";
                startConfig[id + "winGold"]   = "true";
                startConfig[id + "loseKing"]  = "true";
                PlayerSelectSplitElement psse = new PlayerSelectSplitElement(startConfig, id++);
                (tab as GeneralSplitTab).Add(psse);

                disabled = null;
                //UpdateButtonText();
            });

            panel.AddHeaderLabel("Options");
            L.b.gameOptions.GetAllByCategory("general", null).ForEach(o => o.AddOption(panel));
        }
Пример #24
0
        public void BuildPanel(PanelBuilder panel, string title, MapElementInfo onMap, NVector pos)
        {
            try
            {
                //addHeader
                if (reqs.Count == 0)
                {
                    return;
                }

                panel.AddHeaderLabel(title);

                //add req
                foreach (var req in reqs)
                {
                    BaseReq r = OLib.GetReq(req[0]);
                    panel.AddImageLabel(r.Desc(S.ActPlayer(), onMap, req[1], pos), r.Check(S.ActPlayer(), onMap, req[1], pos));
                }
            }
            catch (Exception e)
            {
                ExceptionHelper.ShowException(e);
            }
        }
Пример #25
0
 public override void ShowDetail(PanelBuilder panel)
 {
     panel.AddHeaderLabel("More maps");
     panel.AddLabel("You can find more maps in the mod section");
 }
Пример #26
0
 public override void ShowDetail(PanelBuilder panel)
 {
     panel.AddHeaderLabel("Level");
     panel.AddInput("Level", town.level, (s => { town.level = s; }));
 }