Exemple #1
0
            public static CreateResult create(AccessToken token, ActionName action_name, int scene_id)
            {
                var    path = "qrcode/create?access_token=" + token;
                object data;

                if (action_name == ActionName.QR_SCENE)
                {
                    data = new
                    {
                        expire_seconds = 604800,
                        action_name    = action_name.ToString(),
                        action_info    = new
                        {
                            scene = new { scene_id }
                        }
                    };
                }
                else
                {
                    data = new
                    {
                        action_name = action_name.ToString(),
                        action_info = new
                        {
                            scene = new { scene_id }
                        }
                    };
                }

                var obj = Call <CreateResult>(path, new CreateResult(), data);

                return(obj);
            }
Exemple #2
0
 public ValidationFunctionAttribute(string urlRedirect, ActionName allowFunctionCode)
 {
     UrlRedirect        = urlRedirect;
     AllowFunctionCodes = new List <string> {
         allowFunctionCode.ToString()
     };
 }
Exemple #3
0
 public ValidationFunctionAttribute(ActionName allowFunctionCode)
 {
     AllowFunctionCodes = new List <string>();
     AllowFunctionCodes.Add(allowFunctionCode.ToString());
 }
Exemple #4
0
 public ValidationFunctionAttribute(ActionName allowFunctionCode)
 {
     AllowFunctionCodes = new List <string> {
         allowFunctionCode.ToString()
     };
 }
Exemple #5
0
 public static bool Add(ActionName actName, string actContent)
 {
     try
     {
         string sql = "Insert into ActionLog(ID,ActionName,ActionTime,AdminId,ActionContent)values(@ID,@ActionName,@ActionTime,@AdminId,@ActionContent)";
         if (DBHelper.ExecuteNonQuery(sql, new string[] { "@ID", "@ActionName", "@ActionTime", "@AdminId", "@ActionContent" },
                                      new object[] { Guid.NewGuid().ToString("N"), actName.ToString(), DateTime.Now, CommStatic.MyCache.Login.Id, actContent }) > 0)
         {
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(ActionLog));
         return(false);
     }
 }
Exemple #6
0
 public static bool IsSuspensionAction(this ActionName action)
 {
     return(action.ToString().StartsWith("Suspend"));
 }
            public virtual void OnGUI()
            {
                EditorGUILayout.Space();
                using (new EditorHelper.Box(true, 0))
                {
                    using (new EditorHelper.Indent(-4))
                        using (new EditorHelper.Horizontal())
                        {
                            enabled = EditorGUILayout.Toggle(enabled, GUILayout.ExpandWidth(false), GUILayout.Width(15));

                            bool existed = Config.actionFold.ContainsKey(this);
                            if (!existed)
                            {
                                Config.actionFold[this] = true;
                            }

                            bool          foldout = Config.actionFold[this];
                            GUIStyle      gs      = new GUIStyle(EditorStyles.foldout);
                            GUIStyleState normal  = new GUIStyleState();
                            normal.textColor = new Color(226 / 255f, 100 / 255f, 226 / 255f, 1);
                            gs.fontStyle     = FontStyle.Bold;
                            gs.normal        = normal;
                            gs.focused       = normal;
                            gs.hover         = normal;
                            gs.active        = normal;
                            gs.onActive      = normal;
                            gs.onFocused     = normal;
                            gs.onHover       = normal;
                            gs.onNormal      = normal;

                            foldout = GUILayout.Toggle(
                                foldout, $"{GetTitleText()}", gs,
                                GUILayout.ExpandWidth(false), GUILayout.Width(150)
                                );

                            if (Config.actionFold[this] != foldout)
                            {
                                Config.ResetCacheRectData();
                            }
                            Config.actionFold[this] = foldout;
                            if (!foldout)
                            {
                                return;
                            }

                            IsRemoved = GUILayout.Button("Remove", GUILayout.Width(80));

                            if (GUILayout.Button("Copy", GUILayout.Width(80)))
                            {
                                copiedAction = this;
                            }

                            IsPasted = GUILayout.Button("Paste", GUILayout.Width(80));
                        }

                    using (new EditorHelper.Indent(-3))
                    {
                        ActionLayer layer = ShowActionLayer();
                        layer       = (ActionLayer)EditorGUILayout.EnumPopup("Active Layer", layer);
                        actionLayer = layer.ToString();

                        if (!Config.showSpawnerMode)
                        {
                            ActionName oldActionName = ShowActionName();
                            ActionName newActionName = (ActionName)EditorGUILayout.EnumPopup(
                                "Action Name", oldActionName);
                            actionName      = newActionName.ToString();
                            IsActionChanged = !oldActionName.Equals(newActionName);
                        }

                        ActionTriggerCondition oldCondition = ShowTriggerCondition();
                        ActionTriggerCondition newCondition = (ActionTriggerCondition)EditorGUILayout.EnumPopup("Trigger Condition", oldCondition);
                        triggerCondition = newCondition.ToString();

                        if (newCondition == ActionTriggerCondition.Time)
                        {
                            waitTime = EditorGUILayout.FloatField("Activate at(s)", waitTime);
                            waitTime = Mathf.Max(0, waitTime);
                        }
                        else if (newCondition == ActionTriggerCondition.ByEvent)
                        {
                            eventId = EditorGUILayout.IntField("Event ID", eventId);
                        }
                        else if (newCondition == ActionTriggerCondition.OnWaveFinish)
                        {
                            waveOrder = EditorGUILayout.IntField("Wave Order", waveOrder);
                            waveOrder = Mathf.Max(1, waveOrder);
                        }

                        DrawGUI();
                    }
                }
            }