Пример #1
0
        public void AddNewActionButton(ActionHolders holder, ActionHolder action, MapElementInfo info,
                                       GameObject actionPanel)
        {
            if (action == null)
            {
                throw new MissingMemberException($"Action for {info} is missing.");
            }

            //BasePerformAction ba = action.PerformAction();
            FDataAction da = action.DataAction();

            //can add under construction?
            if (info.IsUnderConstruction() && !da.useUnderConstruction)
            {
                return;
            }

            //can add from diff player?
            if (da.onlyOwner && !info.Owner(S.ActPlayerID()))
            {
                return;
            }

            //can add final?
            if (!action.req.Check(S.ActPlayer(), info, info.Pos(), true))
            {
                return;
            }

            Button button = UIElements.CreateImageButton(da.Sprite(), actionPanel.transform, () =>
            {
                PerformAction(holder, action, info);
            }, da.sound);

            UIHelper.HoverEnter(button,
                                () => { ShowPanelMessage(S.T("actionTooltip", LSys.tem.inputs.ActionName(da), action.cost, info.data.ap)); },
                                () => { ShowPanelMessage(info.Status(S.ActPlayerID())); });
        }
Пример #2
0
        public override void ShowLexicon(PanelBuilder panel, MapElementInfo onMap, NVector pos)
        {
            if (onMap == null)
            {
                ShowIntern(panel, null, pos);

                ActionDisplaySettings sett = new ActionDisplaySettings(panel, S.ActPlayer(), null, pos, null);
                sett.compact = true;
                action.BuildPanelT(sett);
                return;
            }

            if (!onMap.Owner(S.ActPlayerID()))
            {
                ShowLexicon(panel);
                return;
            }

            pos = onMap.Pos();
            ShowIntern(panel, onMap, pos);

            onMap.data.action.BuildPanelT(new ActionDisplaySettings(panel, onMap.Player(), onMap, pos, null));
        }