Exemplo n.º 1
0
        public override void ShowDetail(PanelBuilder panel)
        {
            panel.AddHeaderLabelT("name");
            panel.AddInputRandom("Name", startConfig[id + "name"], s => {
                startConfig[id + "name"] = s;
                UIHelper.UpdateButtonText(button, s);
            }, () => LClass.s.NameGenerator("unit"));

            panel.AddHeaderLabelT("nation");
            panel.AddDropdown(L.b.nations.Values().ToList(), startConfig[id + "nation"],
                              s => {
                startConfig[id + "nation"] = s;
            });

            panel.AddHeaderLabelT("coat");
            panel.AddDropdown(L.b.coats.GetAllByCategory("kingdom"), startConfig[id + "coat"],
                              s => {
                startConfig[id + "coat"] = s;
                UIHelper.UpdateButtonImage(button, L.b.coats[s].Sprite());
            });

            panel.AddHeaderLabelT("endlessWin");
            panel.AddCheckbox(Boolean.Parse(startConfig[id + "winGold"]), S.T("endlessWinGold"), b =>
            {
                startConfig[id + "winGold"] = b.ToString();
            });

            panel.AddHeaderLabelT("endlessLose");
            panel.AddCheckbox(Boolean.Parse(startConfig[id + "loseKing"]), S.T("endlessLoseUnit"), b =>
            {
                startConfig[id + "loseKing"] = b.ToString();
            });
        }
Exemplo n.º 2
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);
                }
            }
        }
Exemplo n.º 3
0
 public override void ShowDetail(PanelBuilder panel)
 {
     panel.AddHeaderLabelT("general");
     panel.AddSubLabel("Total",_mapElementInfo.data.spells.total.ToString());
     panel.AddHeaderLabelT("spell");
     foreach (var s in _mapElementInfo.data.spells.known)
     {
         Spell spell = L.b.spells[s];
         panel.AddSubLabel(spell.Name(), _mapElementInfo.data.spells.count[s].ToString(), spell.Icon);
     }
 }
Exemplo n.º 4
0
        public override void ShowDetail(PanelBuilder panel)
        {
            panel.AddHeaderLabelT("languageSelect");
            panel.AddDesc(S.T("languageInfo"));
            panel.AddImageTextButton(S.T("languageSystem"), "language", (() => UpdateLang("languageSystem")));
            foreach (var lang in LSys.tem.languages.Values())
            {
                panel.AddImageTextButton(lang.Name(), lang.Icon, (() => UpdateLang(lang.id)));
            }

            panel.AddHeaderLabelT("task");
            panel.AddButtonT("languageHelp", (() => Application.OpenURL("https://9nations.de/files/directLinksN.php?typ=translate")));
        }
Exemplo n.º 5
0
        private void ShowIntern(PanelBuilder panel, MapElementInfo onMap, NVector pos)
        {
            base.ShowLexicon(panel);
            var b = L.b.modifiers[C.BuildRes].CalcText(buildTime, S.ActPlayer(), pos);

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

            int _view = onMap == null ? visibilityRange : onMap.data.visibilityRange;
            int _atk  = onMap == null ? atk : onMap.data.atk;
            int _def  = onMap == null ? def : onMap.data.def;

            var v = L.b.modifiers[C.ViewModi].CalcText(_view, S.ActPlayer(), pos);

            L.b.modifiers[C.ViewModi].AddSubLabel(panel, v.value, "field", v.display);
            ShowWorker(panel);

            if (_atk > 0 || _def > 0)
            {
                panel.AddHeaderLabelT("fight");
            }
            panel.AddSubLabelT("atk", _atk, "atk");
            panel.AddSubLabelT("def", _def, "def");

            panel.AddResT("constructionCost", cost);
            req.BuildPanel(panel, S.T("constructionReq"), null, pos);
            panel.AddModi(modi);
        }
Exemplo n.º 6
0
        public override void ShowDetail(PanelBuilder panel)
        {
            //res
            town.ShowCombineRes(panel);

            //res
            town.ShowRes(panel);

            //show grow last round
            bool found = false;

            foreach (var r in town.resStatistic.GetLast(ResType.Produce))
            {
                var i = L.b.res[r.Key];
                if (i.special || i.Hidden)
                {
                    continue;
                }

                if (!found)
                {
                    found = true;
                    panel.AddHeaderLabelT("townProduceLastRound");
                }
                i.AddImageLabel(panel, (int)r.Value);
            }
        }
Exemplo n.º 7
0
 public override void ShowDetail(PanelBuilder panel)
 {
     panel.AddHeaderLabelT("general");
     panel.AddSubLabel("Name", _player.name, _player.Coat().Icon);
     panel.AddSubLabel(L.b.nations.Name(), _player.Nation().Name(), _player.Nation().Icon);
     panel.AddSubLabel("Points", _player.points.ToString());
     panel.AddModi(S.Game().data.modi);
 }
Exemplo n.º 8
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();
        }
Exemplo n.º 9
0
        public override void ShowLexicon(PanelBuilder panel)
        {
            base.ShowLexicon(panel);

            if (category == "construction")
            {
                panel.AddHeaderLabelT("construction");
                panel.AddSubLabelT("hp", hp, "hp");
                panel.AddSubLabelT("ap", ap, "ap");
                panel.AddModi(modi);
            }

            if (category == "food")
            {
                panel.AddHeaderLabelT("food");
                panel.AddSubLabelT("hp", hp, "hp");
                panel.AddSubLabelT("ap", ap, "ap");
                panel.AddModi(modi);
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 11
0
        public void ShowRes(PanelBuilder panel)
        {
            if (res.Count > 0)
            {
                panel.AddHeaderLabelT("resources");
            }

            foreach (var r in res)
            {
                var res = L.b.res[r.Key];
                if (!res.special)
                {
                    res.AddImageLabel(panel, (int)r.Value);
                }
            }
        }
Exemplo n.º 12
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);
                }
            }
        }
Exemplo n.º 13
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");
            }
        }
Exemplo n.º 14
0
        protected void AddItem(PanelBuilder panel, string id, string category)
        {
            panel.AddHeaderLabelT("item" + id);

            string title = S.T("itemEquipNo");
            string icon  = "no";

            if (_info.data.items.ContainsKey(id))
            {
                var item = L.b.items[_info.data.items[id]];
                title = item.Name();
                icon  = item.Icon;
            }

            var b = panel.AddImageTextButton(title, icon, () => { });

            b.onClick.AddListener(() => { Equip(id, category, b); });
        }
Exemplo n.º 15
0
        public override void ShowLexicon(PanelBuilder panel, [CanBeNull] MapElementInfo onMap, [CanBeNull] NVector pos)
        {
            base.ShowLexicon(panel);
            if (!string.IsNullOrEmpty(winter))
            {
                DataTerrain w = L.b.terrains[winter];
                panel.AddSubLabel(S.T("terrainPassableWinter"), w.Name(), w.Sprite());
            }

            panel.AddHeaderLabelT("move");
            foreach (Movement m in L.b.movements.Values())
            {
                int costO = MoveCost(m.id);
                int cost  = pos == null?costO:GameMgmt.Get().newMap.PathFinding(pos.level).CostNode(S.ActPlayer(), m.id, pos);

                var mess = S.T("terrainPassable", cost == 0?S.T("terrainPassableNot"):S.T("terrainPassableAP", cost), cost == costO ? "" : S.T("terrainPassableOrg", costO == 0?S.T("terrainPassableNot"):S.T("terrainPassableAP", costO)));
                panel.AddSubLabel(m.Name(), mess, m.Icon);
            }
            //if (movement.Count == 0) panel.AddImageLabel(S.T("terrainPassableNot"),"no");
            panel.AddModi(modi);

            ShowRes(panel, S.IsGame()?S.ActPlayer():null, pos);
        }
Exemplo n.º 16
0
        public void ShowCombineRes(PanelBuilder panel)
        {
            bool found = false;

            foreach (var r in L.b.res.Values())
            {
                if (String.IsNullOrEmpty(r.combine))
                {
                    continue;
                }

                var erg = GetRes(r.combine);

                //found?
                if (!found)
                {
                    panel.AddHeaderLabelT("resources");
                }

                r.AddImageLabel(panel, erg);

                found = true;
            }
        }
Exemplo n.º 17
0
        public override void ShowDetail(PanelBuilder panel)
        {
            ShowInhabitants(panel);

            //usage?
            if (!L.b.gameOptions["usageTown"].Bool())
            {
                return;
            }

            var inh = town.GetRes(C.Inhabitant);

            panel.AddSubLabel("Productivity", town.modi["produce"], "res");
            if (town.usageMess != null)
            {
                panel.AddSubLabel("Status", town.usageMess);
            }

            int usages = 0;

            panel.AddHeaderLabelT("usageRound");

            //find usage count
            foreach (Usage usage in L.b.usages.Values())
            {
                //can use?
                if (!usage.req.Check(town.Player()))
                {
                    continue;
                }

                usages += usage.factor;
            }
            int usageMax = usages;


            //use usage
            foreach (Usage usage in L.b.usages.Values())
            {
                //can use?
                if (!usage.req.Check(town.Player()))
                {
                    continue;
                }

                var r = L.b.res[usage.id];

                int amount    = (int)Math.Round(inh * usage.rate);
                int hasAmount = town.GetRes(r.id);

                panel.AddSubLabel(usage.Name(), S.T("usageRoundRes", amount, hasAmount), usage.Icon);
                //need res?
                if (amount >= 0 || amount * -1 <= hasAmount)
                {
                    usages -= 1;
                }
            }

            //worker
            //res

            panel.AddHeaderLabelT("usageRoundResult");
            panel.AddImageLabel(S.T("usageRoundResultStatus", usageMax - usages, usageMax - town.level), "usage");
            panel.AddImageLabel(town.level >= usages?S.T("usageRoundResultStatusFulfilled"):S.T("usageRoundResultStatusNotFulfilled"), town.level >= usages);
        }
Exemplo n.º 18
0
 public override void ShowDetail(PanelBuilder panel)
 {
     panel.AddHeaderLabelT("elementFreeUnit");
     L.b.units["christkind"].AddImageLabel(panel);
 }
Exemplo n.º 19
0
 public override void ShowDetail(PanelBuilder panel)
 {
     panel.AddHeaderLabelT("itemEquipNo");
     panel.AddLabelT("itemEquipUn");
 }