Exemple #1
0
        public virtual void ActionUpdate(IO.Swagger.Model.Action action, bool updateConnections = false)
        {
            // Updates (or creates new) parameters of current action
            foreach (IO.Swagger.Model.ActionParameter projectActionParameter in action.Parameters)
            {
                try {
                    // If action parameter exist in action dictionary, then just update that parameter value (it's metadata will always be unchanged)
                    if (Parameters.TryGetValue(projectActionParameter.Name, out Parameter actionParameter))
                    {
                        actionParameter.UpdateActionParameter(DataHelper.ActionParameterToParameter(projectActionParameter));
                    }
                    // Otherwise create a new action parameter, load metadata for it and add it to the dictionary of action
                    else
                    {
                        // Loads metadata of specified action parameter - projectActionParameter. Action.Metadata is created when creating Action.
                        IO.Swagger.Model.ParameterMeta actionParameterMetadata = Metadata.GetParamMetadata(projectActionParameter.Name);

                        actionParameter = new Parameter(actionParameterMetadata, projectActionParameter.Value);
                        Parameters.Add(actionParameter.Name, actionParameter);
                    }
                } catch (ItemNotFoundException ex) {
                    Debug.LogError(ex);
                }
            }
        }
 public void ActionBaseUpdated(IO.Swagger.Model.Action projectAction)
 {
     Base.Action action = GetAction(projectAction.Id);
     if (action == null)
     {
         Debug.LogError("Trying to update non-existing action!");
         return;
     }
     action.ActionUpdateBaseData(projectAction);
     OnProjectChanged?.Invoke(this, EventArgs.Empty);
 }
    public virtual void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider, string actionType)
    {
        base.Init(projectAction, metadata, ap, actionProvider);

        if (!Base.ProjectManager.Instance.ProjectMeta.HasLogic)
        {
            Destroy(gameObject);
            return;
        }
        playerPrefsKey = "project/" + ProjectManager.Instance.ProjectMeta.Id + "/" + actionType;
    }
    private void Awake()
    {
        IO.Swagger.Model.Action projectAction = new IO.Swagger.Model.Action(
            flows: new List <IO.Swagger.Model.Flow>(),
            id: "END",
            name: "END",
            parameters: new List <IO.Swagger.Model.ActionParameter>(),
            type: "");

        Init(projectAction, null, null, null, "END");
    }
        public void ActionAdded(IO.Swagger.Model.Action projectAction, string parentId)
        {
            ActionPoint     actionPoint    = GetActionPoint(parentId);
            IActionProvider actionProvider = GetActionProvider(Action.ParseActionType(projectAction.Type).Item1);

            Base.Action action = SpawnAction(projectAction.Id, projectAction.Name, Action.ParseActionType(projectAction.Type).Item2, actionPoint, actionProvider);
            // updates name of the action
            action.ActionUpdateBaseData(projectAction);
            // updates parameters of the action
            action.ActionUpdate(projectAction);
            OnProjectChanged?.Invoke(this, EventArgs.Empty);
        }
Exemple #6
0
 public override void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider, string keySuffix)
 {
     IO.Swagger.Model.Action prAction = new IO.Swagger.Model.Action(
         flows: new List <IO.Swagger.Model.Flow>(),
         id: "END",
         name: "END",
         parameters: new List <IO.Swagger.Model.ActionParameter>(),
         type: "");
     base.Init(prAction, metadata, ap, actionProvider, keySuffix);
     transform.localPosition = PlayerPrefsHelper.LoadVector3(playerPrefsKey, new Vector3(0, 0.1f, 0));
     //Input.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Input);
 }
Exemple #7
0
 public virtual void Init(IO.Swagger.Model.Action projectAction, ActionMetadata metadata, ActionPoint ap, IActionProvider actionProvider)
 {
     ActionPoint    = ap;
     this.metadata  = metadata;
     ActionProvider = actionProvider;
     Data           = projectAction;
     UpdateName(Data.Name);
     if (actionProvider != null)
     {
         UpdateType();
     }
     //UpdateRotation(null);
     SelectorItem = SelectorMenu.Instance.CreateSelectorItem(this);
 }
 private void Awake()
 {
     IO.Swagger.Model.Action projectAction = new IO.Swagger.Model.Action(
         flows: new List <IO.Swagger.Model.Flow> {
         new IO.Swagger.Model.Flow(
             new List <string> {
             "output"
         }, IO.Swagger.Model.Flow.TypeEnum.Default)
     },
         id: "START",
         name: "START",
         parameters: new List <IO.Swagger.Model.ActionParameter>(),
         type: "");
     Init(projectAction, null, null, null, "START");
 }
Exemple #9
0
 public override void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider, string actionType)
 {
     IO.Swagger.Model.Action prAction = new IO.Swagger.Model.Action(
         flows: new List <IO.Swagger.Model.Flow> {
         new IO.Swagger.Model.Flow(
             new List <string> {
             "output"
         }, IO.Swagger.Model.Flow.TypeEnum.Default)
     },
         id: "START",
         name: "START",
         parameters: new List <IO.Swagger.Model.ActionParameter>(),
         type: "");
     base.Init(prAction, metadata, ap, actionProvider, actionType);
     transform.localPosition = PlayerPrefsHelper.LoadVector3(playerPrefsKey, new Vector3(0, 0.15f, 0));
     // Output.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Output);
 }
Exemple #10
0
        public virtual void Init(IO.Swagger.Model.Action projectAction, ActionMetadata metadata, ActionPoint ap, IActionProvider actionProvider)
        {
            ActionPoint         = ap;
            this.metadata       = metadata;
            this.ActionProvider = actionProvider;
            Data = projectAction;

            if (!Base.ProjectManager.Instance.ProjectMeta.HasLogic)
            {
                InputArrow.gameObject.SetActive(false);
                OutputArrow.gameObject.SetActive(false);
            }


            UpdateName(Data.Name);
            if (actionProvider != null)
            {
                UpdateType();
            }
            foreach (InputOutput io in GetComponentsInChildren <InputOutput>())
            {
                io.Init(null);
            }
        }
 public ActionEventArgs(IO.Swagger.Model.Action action)
 {
     Action = action;
 }
Exemple #12
0
 public static IO.Swagger.Model.BareAction ActionToBareAction(IO.Swagger.Model.Action action)
 {
     return(new IO.Swagger.Model.BareAction(id: action.Id, name: action.Name, type: action.Type));
 }
Exemple #13
0
 public override void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider)
 {
     base.Init(projectAction, metadata, ap, actionProvider);
     // Input.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Input);
     //Output.SelectorItem = SelectorMenu.Instance.CreateSelectorItem(Output);
 }
 public void ActionRemoved(IO.Swagger.Model.Action action)
 {
     ProjectManager.Instance.RemoveAction(action.Id);
     OnProjectChanged?.Invoke(this, EventArgs.Empty);
 }
 public override void Init(IO.Swagger.Model.Action projectAction, Base.ActionMetadata metadata, Base.ActionPoint ap, IActionProvider actionProvider, string keySuffix)
 {
     base.Init(projectAction, metadata, ap, actionProvider, keySuffix);
     transform.localPosition = PlayerPrefsHelper.LoadVector3(playerPrefsKey, new Vector3(0.5f, 0, 0));
 }
Exemple #16
0
 public override void ActionUpdateBaseData(IO.Swagger.Model.Action aData = null)
 {
     base.ActionUpdateBaseData(aData);
     NameText.text = aData.Name;
 }