コード例 #1
0
ファイル: Job.cs プロジェクト: Ishitori/Palantir
        private Trigger MakeTrigger(TriggerType triggerType, string name)
        {
            if (this.mTriggerNameTrigger.ContainsKey(name))
            {
                throw new ArgumentException("Trigger with the name \"" + name + "\" already exists.");
            }

            Trigger trigger1 = null;

            switch (triggerType)
            {
            case TriggerType.TimerTrigger:
                trigger1 = new TimerTrigger(name);
                break;

            case TriggerType.CronTrigger:
                trigger1 = new CronTrigger(name);
                break;
            }

            this.AddTrigger(trigger1);
            this.mTriggerNameTrigger[name] = trigger1;
            log.Info("Made " + triggerType.ToString() + " with name \"" + name + "\". Job: " + this.mName);
            trigger1.LogAction += new Trigger.OnLogActionHandler(this.Ret_LogAction);
            return(trigger1);
        }
コード例 #2
0
ファイル: Bot.cs プロジェクト: bonnici/SteamChatBot
        private static BaseTrigger AddTrigger(string name, TriggerType type)
        {
            if (name == null || type.ToString() == null)
            {
                Log.Instance.Error("{0}/ChatBot (unknown trigger): Trigger not defined correctly. Not loading...", name);
                return null;
            }

            BaseTrigger trigger = triggerFactory.CreateTrigger(type, name);
            try
            {
                Log.Instance.Debug(username + "/ChatBot: Testing onload for {0} trigger {1}", type, name);
                if (trigger != null && trigger.OnLoad())
                {
                    Log.Instance.Silly(username + "/ChatBot: onload success for {0} trigger {1}", type, name);
                    triggers.Add(trigger);
                    return trigger;
                }
                else if (trigger != null)
                {
                    Log.Instance.Error(username + "/ChatBot: Error loading {0} trigger {1}", type, name);
                    return null;
                }
            }
            catch (Exception e)
            {
                Log.Instance.Error(username + "/ChatBot: Error loading {0} trigger {1}: {2}", type, name, e.StackTrace);
                return null;
            }
            return null;
        }
コード例 #3
0
ファイル: TriggerParameters.cs プロジェクト: mrwulf/PrtgAPI
        /// <summary>
        /// Initializes a new instance of the <see cref="TriggerParameters"/> class.
        /// </summary>
        /// <param name="type">The type of notification trigger this object will manipulate.</param>
        /// <param name="objectId">The object ID the trigger will apply to.</param>
        /// <param name="subId">If this trigger is being edited, the trigger's sub ID. If the trigger is being added, this value is null.</param>
        /// <param name="action">Whether to add a new trigger or modify an existing one.</param>
        protected TriggerParameters(TriggerType type, int objectId, int?subId, ModifyAction action)
        {
            if (action == ModifyAction.Add && subId != null)
            {
                throw new ArgumentException("SubId must be null when ModifyAction is Add", nameof(subId));
            }
            else if (action == ModifyAction.Edit && subId == null)
            {
                throw new ArgumentException("SubId cannot be null when ModifyAction is Edit", nameof(subId));
            }

            if (action == ModifyAction.Add)
            {
                OnNotificationAction = null;
            }

            ObjectId = objectId;

            this.subId = action == ModifyAction.Add ? "new" : subId.Value.ToString();
            Action     = action;
            Type       = type;

            this[Parameter.Id]    = objectId;
            this[Parameter.SubId] = this.subId;

            if (action == ModifyAction.Add)
            {
                Parameters.Add(new CustomParameter("class", type.ToString().ToLower())); //todo: does this tolower itself during prtgurl construction? check debug output!
                this[Parameter.ObjectType] = "nodetrigger";
            }
        }
コード例 #4
0
        public override List <KeyValuePair <string, string> > GetVars()
        {
            List <KeyValuePair <string, string> > vars = base.GetVars();

            vars.Add(new KeyValuePair <string, string>("trigger_type", Trigger_Type.ToString().ToLower()));
            return(vars);
        }
コード例 #5
0
        private static BaseTrigger AddTrigger(string name, TriggerType type)
        {
            if (name == null || type.ToString() == null)
            {
                Log.Instance.Error("{0}/ChatBot (unknown trigger): Trigger not defined correctly. Not loading...", name);
                return(null);
            }

            BaseTrigger trigger = triggerFactory.CreateTrigger(type, name);

            try
            {
                Log.Instance.Debug(username + "/ChatBot: Testing onload for {0} trigger {1}", type, name);
                if (trigger != null && trigger.OnLoad())
                {
                    Log.Instance.Silly(username + "/ChatBot: onload success for {0} trigger {1}", type, name);
                    triggers.Add(trigger);
                    return(trigger);
                }
                else if (trigger != null)
                {
                    Log.Instance.Error(username + "/ChatBot: Error loading {0} trigger {1}", type, name);
                    return(null);
                }
            }
            catch (Exception e)
            {
                Log.Instance.Error(username + "/ChatBot: Error loading {0} trigger {1}: {2}", type, name, e.StackTrace);
                return(null);
            }
            return(null);
        }
コード例 #6
0
ファイル: Trigger.cs プロジェクト: jandar78/Novus
        public GeneralTrigger(BsonDocument doc, TriggerType triggerType) {
            TriggerOn = new List<string>();
            And = new List<string>();
            NotOn = new List<string>();
            MessageOverrideAsString = new List<string>();
            if (doc != null && doc.ElementCount > 0 && doc.Contains("TriggerOn")) {
                foreach (var on in doc["TriggerOn"].AsBsonArray) {
                    TriggerOn.Add(on.AsString);
                }
                foreach (var and in doc["And"].AsBsonArray) {
                    And.Add(and.AsString);
                }
                foreach (var not in doc["NoTriggerOn"].AsBsonArray) {
                    NotOn.Add(not.AsString);
                }
                AutoProcess = doc.Contains("AutoProcess") ? doc["AutoProcess"].AsBoolean : false;
                ChanceToTrigger = doc["ChanceToTrigger"].AsInt32;
                script = ScriptFactory.GetScript(doc["ScriptID"].AsString, triggerType.ToString());
                foreach (var overrides in doc["Overrides"].AsBsonArray) {
                    MessageOverrideAsString.Add(overrides.AsString);
                }
                Type = doc["Type"].AsString;
				TriggerId = doc["Id"].AsString;
            }
        }
コード例 #7
0
        public static string GetTriggerTypeString(this TriggerType type)
        {
            switch (type)
            {
            case TriggerType.Larger: return(">");

            case TriggerType.LargerOrEqual: return(">=");

            case TriggerType.Smaller: return("<");

            case TriggerType.SmallerOrEqual: return("<=");

            case TriggerType.Equal: return("==");

            case TriggerType.InOut: return("inout");

            case TriggerType.In: return("in");

            case TriggerType.Out: return("out");

            case TriggerType.Change: return("change");

            case TriggerType.Exp: return("exp");

            case TriggerType.Frozen: return("frozen");

            case TriggerType.Live: return("live");

            default: return(type.ToString());
            }
        }
コード例 #8
0
 private void OnDrawGizmosSelected()
 {
     if (_triggerType.ToString().Contains("Trigger") || _triggerType.ToString().Contains("Collision"))
     {
         if (_colliderType == ColliderType.Box)
         {
             Gizmos.matrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
             Gizmos.color  = Color.yellow;
             Gizmos.DrawWireCube(_areaSize / 2f, _areaSize);
         }
         else if (_colliderType == ColliderType.Sphere)
         {
             Gizmos.color = Color.cyan;
             Gizmos.DrawWireSphere(transform.position, _radius);
         }
     }
 }
コード例 #9
0
        public override string GetTooltipString()
        {
            string s = "";

            s = "Trait Type" + Type.ToString();

            return(s);
        }
コード例 #10
0
 public BaseTrigger CreateTrigger(TriggerType type, string name)
 {
     if(TriggerTypes.ContainsKey(type.ToString()))
     {
         return new BaseTrigger(type, name);
     }
     return null;
 }
コード例 #11
0
 public BaseTrigger CreateTrigger(TriggerType type, string name)
 {
     if (TriggerTypes.ContainsKey(type.ToString()))
     {
         return(new BaseTrigger(type, name));
     }
     return(null);
 }
コード例 #12
0
        // This is the main call to register an action event
        public static void SendActionEvent(MenuAction mAction, TriggerType triggerType)
        {
            var data = new ProBuilderActionData();

            data.actionName    = mAction.menuTitle;
            data.actionType    = mAction.GetType().Name;
            data.subLevel      = ProBuilderToolManager.selectMode.ToString();
            data.subLevelId    = (int)ProBuilderToolManager.selectMode;
            data.triggeredFrom = triggerType.ToString();

            Send(EventName.ProbuilderAction, data);
        }
コード例 #13
0
ファイル: Trigger.cs プロジェクト: yfakariya/Npgsql2
        private void WriteSql(StringBuilder builder, bool temp)
        {
            string name = Name;

            if (temp == true)
            {
                name = String.Format("{0}_{1}", name, Guid.NewGuid().ToString("N"));
            }

            builder.AppendFormat("CREATE TRIGGER [{0}].[{1}]", _table.Catalog, name);
            switch (_triggerOccurs)
            {
            case 0:
                builder.Append(" BEFORE");
                break;

            case 1:
                builder.Append(" AFTER");
                break;

            case 2:
                builder.Append(" INSTEAD OF");
                break;
            }

            builder.AppendFormat(" {0}", _type.ToString().ToUpperInvariant());
            if (_type == TriggerType.Update && String.IsNullOrEmpty(Columns) == false)
            {
                builder.AppendFormat(" OF {0}", Columns);
            }

            builder.AppendFormat(" ON [{0}].[{1}]", _table.Catalog, _table.Name);

            if (EachRow)
            {
                builder.AppendFormat(" FOR EACH ROW");
            }
            if (String.IsNullOrEmpty(When) == false)
            {
                builder.AppendFormat(" WHEN {0}", When);
            }

            builder.AppendFormat("\r\nBEGIN\r\n{0}", SQL);
            SimpleTokenizer.StringParts[] arr = SimpleTokenizer.BreakString(SQL);
            if (arr[arr.Length - 1].sepchar != ';')
            {
                builder.Append(";");
            }

            builder.Append("\r\nEND;");
        }
コード例 #14
0
        public string TriggerName(/*ConnectionType connectionType*/)
        {
            if (this == EmptyDbTrigger)
            {
                throw new NotSupportedException("No sql string can be created for an empty db trigger.");
            }

            var tableAttribute = Type.GetCustomAttribute <TableAttribute>();

            //switch (connectionType)
            //{
            //    case ConnectionType.SqLite:
            return($"[{TriggerType.ToString()}{tableAttribute.Name}]");
            //    case ConnectionType.MsSql:
            //    default:
            //        return $"[{Schema}].[{Name}]";
            //}
        }
コード例 #15
0
ファイル: Trigger.cs プロジェクト: xulouzhe/THUAI3.0
        public Trigger(double x_t, double y_t, TriggerType type_t, int ownerTeam, Talent ownerTalent) : base(x_t, y_t, ObjType.Trigger)
        {
            Layer       = TriggerLayer;
            Movable     = false;
            triggerType = type_t;
            OwnerTeam   = ownerTeam;
            switch (triggerType)
            {
            case TriggerType.Mine:
                hitScore = (int)((ownerTalent == Talent.Technician) ? Configs["Talent"]["Technician"]["Mine"]["Score"] : Configs["Trigger"]["Mine"]["Score"]);
                stunTime = (int)((ownerTalent == Talent.Technician) ? Configs["Talent"]["Technician"]["Mine"]["StunDuration"] : Configs["Trigger"]["Mine"]["StunDuration"]);
                break;

            case TriggerType.Trap:
                stunTime = (int)((ownerTalent == Talent.Technician) ? Configs["Talent"]["Technician"]["Trap"]["StunDuration"] : Configs["Trigger"]["Trap"]["StunDuration"]);
                break;

            case TriggerType.WaveGlue:
                DurationTimer = new System.Threading.Timer((i) => { Parent = null; }, null, (int)Configs["Trigger"]["WaveGlue"]["Duration"], 0);
                break;

            case TriggerType.Bomb:
                stunTime = (int)((ownerTalent == Talent.Technician) ? Configs["Talent"]["Technician"]["Bomb"]["StunDuration"] : Configs["Trigger"]["Bomb"]["StunDuration"]);
                break;

            case TriggerType.Arrow:
                Movable  = true;
                hitScore = (int)((ownerTalent == Talent.StrongMan) ? Configs["Talent"]["StrongMan"]["Arrow"]["Score"] : Configs["Trigger"]["Arrow"]["Score"]);
                stunTime = (int)((ownerTalent == Talent.StrongMan) ? Configs["Talent"]["StrongMan"]["Arrow"]["StunDuration"] : Configs["Trigger"]["Arrow"]["StunDuration"]);
                break;

            case TriggerType.Hammer:
                Movable  = true;
                stunTime = (int)((ownerTalent == Talent.StrongMan) ? Configs["Talent"]["StrongMan"]["Hammer"]["StunDuration"] : Configs["Trigger"]["Hammer"]["StunDuration"]);
                break;
            }
            this.StopMoving += new StopMovingHandler(o => { Parent = null; });
            AddToMessage();
            lock (Program.MessageToClientLock)
                Program.MessageToClient.GameObjectList[ID].TriggerType = triggerType;
            this.MoveComplete   += new MoveCompleteHandler(ChangePositionInMessage);
            this.OnParentDelete += new ParentDeleteHandler(DeleteFromMessage);
            Server.ServerDebug("Create trigger : " + triggerType.ToString());
        }
コード例 #16
0
        public override string ToString()
        {
            var result = TriggerType.ToString();

            if (_triggerOnSampleSet)
            {
                result += SampleSet;
            }
            if (_triggerOnAditionSampleSet)
            {
                result += AdditionSampleSet;
            }
            if (_triggerOnSoundType)
            {
                result += SoundType;
            }
            if (_triggerOnCustom)
            {
                result += (int)Custom;
            }
            return(result);
        }
コード例 #17
0
        public string CreateTriggerSqlString(ConnectionType connectionType)
        {
            if (this == EmptyDbTrigger)
            {
                throw new NotSupportedException("No sql string can be created for an empty db trigger.");
            }

            foreach (var type in RequiredTypes)
            {
                var tableAttribute = type.GetCustomAttribute <TableAttribute>();

                if (tableAttribute == null)
                {
                    throw new ArgumentException("A trigger's required type must be decorated with a table attribute.");
                }

                CreateTriggerScript = CreateTriggerScript.Replace(type.Name, TableName(tableAttribute, connectionType));
            }

            CreateTriggerScript = CreateTriggerScript.Replace("(deleted/OLD)", connectionType == ConnectionType.SqLite ? "OLD" : "deleted");
            CreateTriggerScript = CreateTriggerScript.Replace("(inserted/NEW)", connectionType == ConnectionType.SqLite ? "NEW" : "inserted");

            var selfTableAttribute = Type.GetCustomAttribute <TableAttribute>();

            switch (connectionType)
            {
            case ConnectionType.SqLite:
                return($@"CREATE TRIGGER {TriggerName()}
    {Regex.Replace(TriggerType.ToString(), "((?<=[a-z])[A-Z]|[A-Z](?=[a-z]))", " $1")} ON [{selfTableAttribute.Schema}_{selfTableAttribute.Name}]
BEGIN
    {CreateTriggerScript}
END;");

            case ConnectionType.MsSql:
            default:
                throw new NotImplementedException();
            }
        }
コード例 #18
0
 public void SetTrigger(TriggerType type)
 {
     anim.SetTrigger(type.ToString());
 }
コード例 #19
0
 public void Generate(FizzleJson data)
 {
     _TriggerType = data.GetOrDefault("trigger-type", "once") == "always" ? TriggerType.ALWAYS : TriggerType.ONCE;
     FizzleDebug.Log($"FizzleTrigger name = {(object) data["name"] ?? name}, type = {_TriggerType.ToString()}");
 }
コード例 #20
0
 public override string ToString()
 {
     return(TriggerType.ToString());
 }
コード例 #21
0
 public void SetTrigger(TriggerType type)
 {
     anim.SetTrigger(type.ToString());
 }
コード例 #22
0
        public void OnDrawMoreInfo(SerializedProperty property, Rect position)
        {
            #region Every

            var      index = 0;
            GUIStyle style = new GUIStyle()
            {
                fontSize  = 20,
                alignment = TextAnchor.MiddleCenter,
            };

            EditorGUI.LabelField(position.GetRectFromIndexWithHeight(ref index, 20 + 5), "详细信息", style);

            EditorGUI.LabelField(position.GetRectAtIndex(index++), "类型", type.ToString());
            EditorGUI.LabelField(position.GetRectAtIndex(index++), "ID", id.ToString());
            EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("enable"));
            var workTimeProp = property.FindPropertyRelative("workTimes");
            if (workTimeProp.intValue == 0)
            {
                workTimeProp.intValue = 1;
            }
            EditorGUI.PropertyField(position.GetRectAtIndex(index++), workTimeProp);
            EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("startTime"));
            EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("lastTime"));

            #endregion


            SerializedProperty randomDegreeProp = null;
            SerializedProperty lightTypeProp    = null;
            switch (type)
            {
                #region Effect

            case TriggerType.Effect:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("attackEffects"));
                break;

                #endregion

                #region Trigger2D


            case TriggerType.Trigger2D:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("damageType"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("triggerPath"));

                break;

                #endregion

                #region RayDamage


            case TriggerType.RayDamage:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("degree"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("rayLength"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("hitSpeed"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("rayTestLayer"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("shineLastTime"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("shineDurTime"));
                break;

                #endregion

                #region SingleBullet
            case TriggerType.SingleBullet:
                var bulletProp = property.FindPropertyRelative("bulletName");
                EditorUtil.InitSerializedStringArray(bulletProp.FindPropertyRelative("values"), typeof(PrefabName));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), bulletProp);
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("damageScale"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("gravityScale"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("maxLife"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("speed"));


                lightTypeProp = property.FindPropertyRelative("locateType");
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), lightTypeProp);

                switch (EnumUtil.GetEnumValue <LocateType>(lightTypeProp.enumValueIndex))
                {
                case (int)LocateType.LocateByOffset:
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("offset"));
                    break;

                case (int)LocateType.LocateByBossArea:
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("sideType"));

                    var randomPosProp = property.FindPropertyRelative("randomPos");
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("randomPos"));

                    if (randomPosProp.boolValue)
                    {
                        EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                                property.FindPropertyRelative("interpolationRange"));
                    }
                    else
                    {
                        var interpProp = property.FindPropertyRelative("locateInterpolation");
                        EditorGUI.Slider(position.GetRectAtIndex(index++), interpProp.displayName,
                                         interpProp.floatValue, 0, 1);
                    }
                    break;
                }

                randomDegreeProp = property.FindPropertyRelative("randomDegree");

                EditorGUI.PropertyField(position.GetRectAtIndex(index++), randomDegreeProp);
                if (randomDegreeProp.boolValue)
                {
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("degreeRange"));
                }
                else
                {
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("degree"));
                }


                break;
                #endregion

                #region LightSword

            case TriggerType.LightSword:
                var swordNameProp = property.FindPropertyRelative("swordPrefabName");
                EditorUtil.InitSerializedStringArray(swordNameProp.FindPropertyRelative("values"), typeof(PrefabName));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), swordNameProp);
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("anchorMode"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("damageScale"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("targetSize"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("startSize"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("delayTime"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("widenTime"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("easeType"));

                lightTypeProp = property.FindPropertyRelative("locateType");
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), lightTypeProp);

                switch (EnumUtil.GetEnumValue <LocateType>(lightTypeProp.enumValueIndex))
                {
                case (int)LocateType.LocateByOffset:
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("offset"));
                    break;

                case (int)LocateType.LocateByBossArea:
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("sideType"));

                    var randomPosProp = property.FindPropertyRelative("randomPos");
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("randomPos"));

                    if (randomPosProp.boolValue)
                    {
                        EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                                property.FindPropertyRelative("interpolationRange"));
                    }
                    else
                    {
                        var interpProp = property.FindPropertyRelative("locateInterpolation");
                        EditorGUI.Slider(position.GetRectAtIndex(index++), interpProp.displayName,
                                         interpProp.floatValue, 0, 1);
                    }
                    break;
                }

                randomDegreeProp = property.FindPropertyRelative("randomDegree");

                EditorGUI.PropertyField(position.GetRectAtIndex(index++), randomDegreeProp);
                if (randomDegreeProp.boolValue)
                {
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("degreeRange"));
                }
                else
                {
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("degree"));
                }

                break;

                #endregion

                #region CurveBullet

            case TriggerType.CurvedBullet:
                var curveBulletProp = property.FindPropertyRelative("bulletName");
                EditorUtil.InitSerializedStringArray(curveBulletProp.FindPropertyRelative("values"), typeof(PrefabName));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), curveBulletProp);
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("damageScale"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("gravityScale"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("maxLife"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("aniX"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("aniY"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("reverseX"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("reverseY"));


                break;

                #endregion


                #region Dash

            case TriggerType.Dash:
                break;


                #endregion

                #region Animation


            case TriggerType.Animation:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("animationName"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("animationSpeed"));
                break;

                #endregion

                #region Auido


            case TriggerType.Audio:
                var audioProp = property.FindPropertyRelative("audioName");
                EditorUtil.InitSerializedStringArray(audioProp.FindPropertyRelative("values"), typeof(AudioName));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), audioProp);
                break;

                #endregion
            }
        }
コード例 #23
0
ファイル: Trigger.cs プロジェクト: ProjectEGU/KeyReplace
 public override string ToString()
 {
     if (triggeredBy == TriggerType.KeyDown || triggeredBy == TriggerType.KeyUp)
     {
         return
             ((((winRect == Rectangle.Empty) && !processName.Any()) ? "" : "*") +
              Macro.GetKeyString(vk, modifiers) + (triggeredBy == TriggerType.KeyDown ? "" : " " + triggeredBy.ToString().Replace("Key", "").ToLower()));
     }
     else
     {
         return
             ((((winRect == Rectangle.Empty) && !processName.Any()) ? "" : "*") +
              ((MouseButtons)vk).ToString() + " button" + (triggeredBy == TriggerType.MouseDown ? "" : " up"));
     }
 }
コード例 #24
0
        public void OnDrawMoreInfo(SerializedProperty property, Rect position)
        {
            #region Every

            var      index = 0;
            GUIStyle style = new GUIStyle()
            {
                fontSize  = 20,
                alignment = TextAnchor.MiddleCenter,
            };

            EditorGUI.LabelField(position.GetRectFromIndexWithHeight(ref index, 20 + 5), "详细信息", style);

            EditorGUI.LabelField(position.GetRectAtIndex(index++), "类型", type.ToString());
            EditorGUI.LabelField(position.GetRectAtIndex(index++), "ID", id.ToString());
            EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("enable"));
            EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("startTime"));
            EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("lastTime"));

            #endregion

            switch (type)
            {
                #region Effect

            case TriggerType.Effect:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("attackEffects"));
                break;

                #endregion

                #region Trigger2D


            case TriggerType.Trigger2D:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("damageType"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("triggerPath"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("hitBack"));
                break;

                #endregion

                #region Parabloa


            case TriggerType.Parabloa:


                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("bulletName"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("damage"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("bulletSpeed"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("maxLife"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("timeToTarget"));
                var typeProp = property.FindPropertyRelative("targetType");
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), typeProp);
                switch (typeProp.enumValueIndex)
                {
                case 0:
                    EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("offset"));
                    break;
                }
                break;

                #endregion

                #region RayDamage


            case TriggerType.RayDamage:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("rayDir"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("rayLength"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("hitSpeed"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("rayTestLayer"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("shineLastTime"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("shineDurTime"));
                break;

                #endregion

                #region Bullet
            case TriggerType.Bullet:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("bulletName"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("damage"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("dir"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("bulletSpeed"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("maxLife"));

                break;



                #endregion

                #region Dash

            case TriggerType.Dash:
                break;


                #endregion

                #region Animation


            case TriggerType.Animation:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("animationName"));
                EditorGUI.PropertyField(position.GetRectAtIndex(index++), property.FindPropertyRelative("animationSpeed"));
                break;

                #endregion

                #region Auido


            case TriggerType.Audio:
                EditorGUI.PropertyField(position.GetRectAtIndex(index++),
                                        property.FindPropertyRelative("audioName"));
                break;

                #endregion
            }
        }