Exemple #1
0
        public void Init(TriggerParameterControl parent, TriggerVariable var, TriggerValue val, HighLevelProperty HLProp)
        {
            this.Text = var.Name + " : " + val.Type;

            mVariable = var;
            mValue    = val;
            mParent   = parent;
            mHLProp   = HLProp;

            UpdateControl();

            //save teh mouseclicks.
            if (mValue.Name.Contains((mVariable.Name + TriggerNamespace.GetDefaultVarSuffix())))
            {
                if (TriggerSystemMain.mTriggerDefinitions.IsListType(mValue.Type))
                {
                    mValue.IsNull = false;
                    ////mParent.ParameterMode = TriggerParameterControl.eParameterMode.
                    UpdateControl();
                    InitVarMode();
                }
                else if (parent.ParentTriggerNamespace.IsSharedValueVar(mValue.ID))
                {
                    //SetValueMode();
                }
                else
                {
                    //InitValueMode();
                    SetValueMode();
                }
            }
        }
Exemple #2
0
        void l_DragDrop(object sender, DragEventArgs e)
        {
            Label  l    = sender as Label;
            object data = e.Data.GetData(typeof(TriggerParameterControl));
            TriggerParameterControl otherButton = data as TriggerParameterControl;

            if (otherButton != null)
            {
                TriggerVariable ctrlMove = otherButton.GetVariable();// as TriggerVariable;

                if (e.Effect == DragDropEffects.Move)
                {
                    if (otherButton.ParameterMode == TriggerParameterControl.eParameterMode.Const)
                    {
                        PresentationValue = ctrlMove.ID;
                        l.Text            = mTriggerNamespace.GetValues()[ctrlMove.ID].Value;
                    }
                    else
                    {
                        PresentationValue = ctrlMove.ID;
                        l.Text            = ctrlMove.Name;
                        l.Refresh();
                    }
                    //UpdateControl();
                }
            }
        }
Exemple #3
0
 public TriggerVarJump(GroupUI g, Trigger t, TriggerVariable v, TriggerComponent c, TriggerTemplateMapping m)
 {
     trig  = t;
     var   = v;
     comp  = c;
     group = g;
     map   = m;
 }
Exemple #4
0
        private void TextLabel_DragDrop(object sender, DragEventArgs e)
        {
            object data = e.Data.GetData(typeof(TriggerParameterControl));
            TriggerParameterControl otherButton = data as TriggerParameterControl;

            if (otherButton != null)
            {
                TriggerVariable ctrlMove   = otherButton.mVariable as TriggerVariable;
                TriggerVariable ctrlTarget = this.mVariable as TriggerVariable;

                if (e.Effect == DragDropEffects.Move)
                {
                    //if (TriggerSystemMain.mTriggerDefinitions.IsListType(otherButton.mValue.Type) && otherButton.ParameterMode == eParameterMode.Const)
                    //{
                    //   SetVarMode(ctrlMove.ID);

                    //}
                    /*else*/ if (otherButton.ParameterMode == eParameterMode.Const)
                    {
                        SetValueMode();
                        mValue.Value = otherButton.mValue.Value;
                    }
                    else
                    {
                        SetVarMode(ctrlMove.ID);
                        //ctrlTarget.ID = ctrlMove.ID;
                        //mValue = otherButton.mValue;

                        //mBinder.UpdateValue(mValue);
                        //ParentTriggerNamespace.ProcessVarMapping();
                        if ((mHost == null) && (mUIUpdateRoot == null))
                        {
                            UpdateParent();
                        }
                        if (mUIUpdateRoot != null)
                        {
                            mUIUpdateRoot.UIUpdate(mValue, new BasicArgument(BasicArgument.eArgumentType.Refresh), eUpdateVisibilty.AnyVisiblity);
                        }
                        if (mHost != null)
                        {
                            mHost.UIUpdate(mValue, new BasicArgument(BasicArgument.eArgumentType.Refresh), eUpdateVisibilty.AnyVisiblity);
                        }
                    }
                    UpdateControl();
                }
                if (e.Effect == DragDropEffects.Link)
                {
                    if (otherButton.ParameterMode == eParameterMode.Const)
                    {
                        SetValueMode();
                        mValue.Value = TriggerSystemMain.mTriggerDefinitions.ConvertConst(otherButton.mValue.Value, otherButton.mValue.Type, this.mValue.Type).ToString();
                        UpdateControl();
                    }
                }
            }
        }
Exemple #5
0
        public void Init(TriggerComponent comp, TriggerVariable var, TriggerValue val, TriggerNamespace trigNS)//, Trigger trigger)
        {
            mComponent = comp;
            mVariable  = var;
            mValue     = val;

            ParentTriggerNamespace = trigNS;
            //Trigger = trigger;

            InitHLProp();

            UpdateControl();
        }
Exemple #6
0
        public Control BuildUIFromParameterVariable(TriggerComponent comp, TriggerVariable var, TriggerValue val, bool watchForChange)
        {
            TriggerParameterControl c = new TriggerParameterControl();

            c.Init(comp, var, val, ParentTriggerNamespace);//, Trigger);
            c.HotSelect    += new EventHandler(c_HotSelect);
            c.HotSelectEnd += new EventHandler(c_HotSelectEnd);

            if (watchForChange)
            {
                c.LabelChanged += new EventHandler(c_LabelChanged);
            }
            return(c);
        }
Exemple #7
0
        public void UIUpdate(object data, object arguments, eUpdateVisibilty visiblity, ref List <Control> owners)
        {
            BasicArgument ba = arguments as BasicArgument;

            if (data == null)
            {
            }
            else if (data is TriggerValue && (((TriggerValue)data).ID == mValue.ID) && (ba != null))
            {
                if (ba.mArgument == BasicArgument.eArgumentType.Refresh)
                {
                    UpdateControl();
                }
                else if (ba.mArgument == BasicArgument.eArgumentType.Select)
                {
                    ShowSelected(true);
                }
                else if (ba.mArgument == BasicArgument.eArgumentType.Deselect)
                {
                    ShowSelected(false);
                }
                else if (ba.mArgument == BasicArgument.eArgumentType.Search)
                {
                    owners.Add(this);
                }
                else if (ba.mArgument == BasicArgument.eArgumentType.HighlightError)
                {
                    ShowSelectedError(true);
                }
            }
            else if (data is TriggerVariable && (((TriggerVariable)data) == mVariable) && (ba != null))
            {
                if (ba.mArgument == BasicArgument.eArgumentType.Search)
                {
                    owners.Add(this);
                }
            }
            else if (data is TriggerVariable && (ba != null))
            {
                TriggerVariable searchvar = data as TriggerVariable;
                //This ain't quite right..  it just mostly matches but lacks its own id
                if (searchvar.ID == mVariable.ID && searchvar.Name == mVariable.Name && searchvar.SigID == mVariable.SigID)
                {
                    if (ba.mArgument == BasicArgument.eArgumentType.Search)
                    {
                        owners.Add(this);
                    }
                }
            }
        }
Exemple #8
0
        private void PopupEditor()
        {
            if (mbOpen == true)
            {
                return; //haha
            }
            mBackupValue = this.mValue.GetCopy();
            mBackupVar   = this.mVariable.GetCopy();

            mbOpen = true;

            TriggerPopupInputForm f = new TriggerPopupInputForm();
            Point p1 = new Point(0, 0);
            Point p2 = this.PointToScreen(p1);

            f.StartPosition = FormStartPosition.Manual;
            p2.Y           -= 30;
            p2.X           -= 60;
            f.Location      = p2;

            f.Init(this, mVariable, mValue, mHLProp);
            f.FormClosed += new FormClosedEventHandler(f_FormClosed);
            f.Show();
        }
Exemple #9
0
    public void PopulateContainer()
    {
        TriggerVariables.Clear();
        BoolVariables.Clear();
        IntVariables.Clear();
        FloatVariables.Clear();
        Vector2Variables.Clear();
        Vector3Variables.Clear();
        QuaternionVariables.Clear();
        TimerVariables.Clear();

        foreach (var propertyPath in AssetDatabaseUtils.GetAssetRelativePaths(FolderPath, IncludeSubdirectories))
        {
            TriggerVariable assetAsTrigger =
                AssetDatabase.LoadAssetAtPath(propertyPath, typeof(TriggerVariable)) as TriggerVariable;
            if (assetAsTrigger != null)
            {
                TriggerVariables.Add(assetAsTrigger);
                continue;
            }

            BoolVariable assetAsBool =
                AssetDatabase.LoadAssetAtPath(propertyPath, typeof(BoolVariable)) as BoolVariable;
            if (assetAsBool != null)
            {
                BoolVariables.Add(assetAsBool);
                continue;
            }

            IntVariable assetAsInt =
                AssetDatabase.LoadAssetAtPath(propertyPath, typeof(IntVariable)) as IntVariable;
            if (assetAsInt != null)
            {
                IntVariables.Add(assetAsInt);
                continue;
            }

            FloatVariable assetAsFloat =
                AssetDatabase.LoadAssetAtPath(propertyPath, typeof(FloatVariable)) as FloatVariable;
            if (assetAsFloat != null)
            {
                FloatVariables.Add(assetAsFloat);
                continue;
            }

            Vector2Variable assetAsVector2 =
                AssetDatabase.LoadAssetAtPath(propertyPath, typeof(Vector2Variable)) as Vector2Variable;
            if (assetAsVector2 != null)
            {
                Vector2Variables.Add(assetAsVector2);
                continue;
            }

            Vector3Variable assetAsVector3 =
                AssetDatabase.LoadAssetAtPath(propertyPath, typeof(Vector3Variable)) as Vector3Variable;
            if (assetAsVector3 != null)
            {
                Vector3Variables.Add(assetAsVector3);
                continue;
            }

            QuaternionVariable assetAsQuaternion =
                AssetDatabase.LoadAssetAtPath(propertyPath, typeof(QuaternionVariable)) as QuaternionVariable;
            if (assetAsQuaternion != null)
            {
                QuaternionVariables.Add(assetAsQuaternion);
                continue;
            }

            TimerVariable assetAsTimer =
                AssetDatabase.LoadAssetAtPath(propertyPath, typeof(TimerVariable)) as TimerVariable;
            if (assetAsTimer != null)
            {
                TimerVariables.Add(assetAsTimer);
                continue;
            }

            FunctionVariable assetAsFunction =
                AssetDatabase.LoadAssetAtPath(propertyPath, typeof(TimerVariable)) as FunctionVariable;
            if (assetAsFunction != null)
            {
                FunctionVariables.Add(assetAsFunction);
                continue;
            }
        }
        Debug.Log($"{TriggerVariables.Count} Triggers" +
                  $" | {BoolVariables.Count} Bools" +
                  $" | {IntVariables.Count} Ints" +
                  $" | {FloatVariables.Count} Floats" +
                  $" | {Vector2Variables.Count} Vector2s" +
                  $" | {Vector3Variables.Count} Vector3s" +
                  $" | {QuaternionVariables.Count} Quaternions" +
                  $" | {TimerVariables.Count} Timers" +
                  $" | {FunctionVariables.Count} Functions");
    }