예제 #1
0
        public IAction[] GetAllActionsFlat()
        {
            var result = ActionHolders
                         .Select(x => x.Action)
                         .Union(
                ActionHolders
                .Where(x => x.Action is IMultipleAction multipleAction)
                .Select(x => ((IMultipleAction)x.Action).GetAllActionsFlat()).SelectMany(x => x)).ToArray();

            return(result);
        }
예제 #2
0
 private void BaseInit(MapElementInfo mei, BaseDataBuildingUnit d, CalculatedData calc)
 {
     action              = new ActionHolders(d.action);
     sprite              = d.Icon;
     name                = d.Name();
     hp                  = calc.hp;
     hpMax               = calc.hp;
     ap                  = calc.ap;
     apMax               = calc.ap;
     atk                 = d.atk;
     def                 = d.def;
     visibilityRange     = d.visibilityRange;
     data                = new Dictionary <string, string>();
     items               = new Dictionary <string, string>();
     modi                = new Dictionary <string, string>();
     spells              = new MapElementSpells();
     info                = new MapElementInfoInfoMgmt();
     info.mapElementInfo = mei;
 }
예제 #3
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())); });
        }
예제 #4
0
        protected void ActionParse(ActionHolders action, string data)
        {
            var a = SplitHelper.Delimiter(data);

            action.Add(LClass.s.GetNewAction(a.key).Create(a.value));
        }
예제 #5
0
파일: Spell.cs 프로젝트: TrutzX/9Nations
 public Spell()
 {
     action     = new ActionHolders();
     actionFail = new ActionHolders();
     reqTarget  = new ReqHolder();
 }
예제 #6
0
 public Item()
 {
     action = new ActionHolders();
 }