/**
	 * {@inheritDoc}
	 */
    //public override bool isAuthorized(clientApplication clientApplication, Action Action, Context Context) {
	public bool isAuthorized(ClientApplication clientApplication, Action Action, Context Context) {
		bool authorized = false;

		//if (clientApplication != null && Action != null && Action.ToString() != null && Action.ToString().Trim().Length() > 0) {
        if (clientApplication != null && Action != null && Action.ToString() != null && Action.ToString().Trim().Length > 0) {
			foreach (Role role in clientApplication.getRoles()) {
				
				//simple check to make sure that 
				//the value of the action matches the value of one of the roles (exact match)
				if (role != null && role.ToString() != null && 
						role.ToString().Equals(Action.ToString())) {
					authorized = true; 
					break;
				}
			}
		}
		
		return authorized;
	}
Пример #2
0
    public static void addListener(Action<object> action, string messageName)
    {
        if(action == null || messageName == null) return;

        BroadcastListener bl = new BroadcastListener();
        bl.action = action;
        bl.messageName = messageName;
        bl.shouldRemove = false;
        broadcastListeners.Add(bl);
        Debug.Log("Listener added for message: " + messageName + " " + action.ToString());
    }
        public static void TrackEvent(Source e, Action action, string label)
        {
            try
            {
                // Terminology borrowed from GA

                // string javaScriptTrack = "_gaq.push(['_trackEvent', '" + e.ToString() + "', '" + action.ToString() + "', '" + label + "']);";
                string javaScriptTrack = "trackEvent('" + e.ToString() + "','" + action.ToString() + "','" + label + "')";
                object returnObject = HtmlPage.Window.Eval(javaScriptTrack);
            }
            catch { }
        }
Пример #4
0
        public async void ChooseAction(Action action)
        {
            infoPanelVM.AddLineToActionLog(Round.CurrentPlayer.name + ": " + action.ToString());
            Round.BiddingDoAction(action);
            while (Round.InBiddingPhase && Round.CurrentPlayer != gameManager.HumanPlayer)
                await AsyncBidAI();

            if (!Round.InBiddingPhase)
            {
                EndBiddingRound();
                CurrentGameState = GameState.PLAYING;
            }
            NotifyUI();
        }
Пример #5
0
        public T Perform(Action <T> action)
        {
            (StepAction <T> stepAction, Action <T> _action) = Action(action?.ToString(), action);

            bool IsPropertyEstablished = typeof(StepAction <T>)
                                         .GetProperties(Public | Instance)
                                         .All(p => p.GetValue(stepAction) != default);

            if (IsPropertyEstablished)
            {
                stepAction.RequireNonNull($"{nameof(stepAction)} is not defined").Accept(this as T);
            }

            return(this as T);
        }
Пример #6
0
        public void Do(Action act, bool select = false)
        {
            if (act.cancel)
                return;

            //First do the action. Only the *new* action
            act.SetEdControl(EdControl);
            act.Redo();
    
            if(select)
                act.AfterAction();
            
            EdControl.mode.Refresh();
            
            //Then save the done action. Merge with previous actions if needed.
            //Determine if the actions should be merged
            if (merge && UActions.Count > 0 && UActions.Peek().CanMerge(act))
                UActions.Peek().Merge(act);
            else
            {
                UActions.Push(act);
                ToolStripMenuItem item = new ToolStripMenuItem(act.ToString());
                item.MouseEnter += new EventHandler(updateActCount);
                item.Click += new EventHandler(onUndoActions);
                undo.DropDownItems.Insert(0, item);
            }

            //Clear the redo buffer because we just did a new action.
            if (redo.DropDownItems.Count > 0) {
                redo.DropDownItems.Clear();
                RActions.Clear();
            }

            //Always after doing an action.
            EdControl.repaint();
            EdControl.GiveFocus();

            //Now set some flags.
            undo.Enabled = true;
            redo.Enabled = false;

            merge = true;
            dirty = true;
        }
    // Update is called once per frame
    void Update()
    {
        TemporaryNameSave1  = new List <string>();
        TemporaryNameSave2  = new List <string>();
        TemporaryValueSave1 = new List <string>();
        TemporaryValueSave2 = new List <string>();
        int d = input.SendFunctionMailNameI.Count;

        for (int i = 0; i < d; i++)
        {
            //Debug.Log("I'm pretty! : " + i);
            //Debug.Log("Fix : " + i);
            //Debug.Log("Oh! Look! It's a new mail! Let's see what's inside! The name is " + input.SendFunctionMailNameI[i] + ".");
            string Type;          //Mail or Save
            int    Port;          //1 or 2
            string GPort;         //Global Port Gestionnairy
            string Action;        //Output.
            string Data;          //Value
            //Port + Type + Action, Value
            //Debug.Log(input.SendFunctionMailNameI[i]);
            Type   = input.SendFunctionMailNameI[0].Split(',')[1];
            Port   = int.Parse((input.SendFunctionMailNameI[0].Split(',')[0]).Split('/')[0]);
            GPort  = (input.SendFunctionMailNameI[0].Split(',')[0]);
            Action = input.SendFunctionMailNameI[0].Split(',')[2];
            Data   = input.SendFunctionMailValueI[0];
            //Debug.Log("Let's see what's inside the mail! Here's what I found:("+Port+","+Type+","+Action+","+Data+")");
            //SendingMessage(Data, Port + "," + Type + "," + Action, true);
            if ((input.SendFunctionMailNameI[0].Split(',')[0]).Split('/').Length > 1)
            {
                if (Type == "Mail")
                {
                    if (Port == 1)
                    {
                        TemporaryNameSave1.Add(PortRemoveUsed(GPort) + "," + Type.ToString() + "," + Action.ToString());
                        TemporaryValueSave1.Add(Data);
                    }
                    else
                    {
                        TemporaryNameSave2.Add(PortRemoveUsed(GPort) + "," + Type.ToString() + "," + Action.ToString());
                        TemporaryValueSave2.Add(Data);
                    }
                }
                else
                {
                    if (Port == 1)
                    {
                        TempN1.ToList().Add(PortRemoveUsed(GPort) + "," + Type.ToString() + "," + Action.ToString());
                        TempV1.ToList().Add(Data);
                    }
                    else
                    {
                        TempN2.ToList().Add(PortRemoveUsed(GPort) + "," + Type.ToString() + "," + Action.ToString());
                        TempV2.ToList().Add(Data);
                    }
                }
            }
            else
            {
                if (Type == "Mail")
                {
                    if (Port == 1)
                    {
                        TemporaryNameSave1.Add(Action);
                        TemporaryValueSave1.Add(Data);
                    }
                    else
                    {
                        TemporaryNameSave2.Add(Action);
                        TemporaryValueSave2.Add(Data);
                    }
                }
                else
                {
                    if (Port == 1)
                    {
                        TempN1.ToList().Add(Action);
                        TempV1.ToList().Add(Data);
                    }
                    else
                    {
                        TempN2.ToList().Add(Action);
                        TempV2.ToList().Add(Data);
                    }
                }
            }
            //Debug.Log("Everything as been send to the Temporary Value Saver...");
            input.SendFunctionMailNameI.RemoveAt(0);
            input.SendFunctionMailValueI.RemoveAt(0);

            HaveNewContent = true;
        }
        if (TempN1 != output1.DataId)
        {
            output1.DataId = TempN1;
        }
        if (TempV1 != output1.Data)
        {
            output1.Data = TempV1;
        }
        if (TempN2 != output2.DataId)
        {
            output2.DataId = TempN2;
        }
        if (TempV2 != output2.Data)
        {
            output2.Data = TempV2;
        }
        if (HaveNewContent)
        {
            //Debug.Log("New contentent!");
            output1.SendFunctionMailNameI  = TemporaryNameSave1;
            output1.SendFunctionMailValueI = TemporaryValueSave1;
            output2.SendFunctionMailNameI  = TemporaryNameSave2;
            output2.SendFunctionMailValueI = TemporaryValueSave2;
            HaveNewContent = false;
        }
    }
Пример #8
0
        public void PrintDebugInfo(string[] oldWords, string [] newWords)
        {
            var oldText = string.Join("", oldWords.Where((s, pos) => pos >= this.StartInOld && pos < this.EndInOld).ToArray());
            var newText = string.Join("", newWords.Where((s, pos) => pos >= this.StartInNew && pos < this.EndInNew).ToArray());

            Debug.WriteLine(string.Format(@"Operation: {0}, Old Text: '{1}', New Text: '{2}'", Action.ToString(), oldText, newText));
        }
 /// <summary>
 /// 覆盖ToString()为OBIS参数形式
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(string.Format("Action = {0}, SelectedNumber = {1}", Action.ToString(), SelectedNumber));
 }
Пример #10
0
 public override string ToString()
 {
     return(Action.ToString());
 }
Пример #11
0
	public void agentActed(IAgent agent, Action action,
			EnvironmentState resultingState) {
		System.Console.WriteLine("Agent acted: " + action.ToString());
	}
Пример #12
0
        //static public decimal SavedMoney { get; set; }
        //static public decimal SavedCoins { get; set; }

        public static string CsvRow()
        {
            return(string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}",

                                 CandleDate.ToString(CultureInfo.InvariantCulture),
                                 Bid.ToString(CultureInfo.InvariantCulture),

                                 Math.Round(EmaDiff, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(Macd, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(MacdStandard, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(Roc, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(RocSpeed, 4).ToString(CultureInfo.InvariantCulture),

                                 CurrentTrend.ToString(),
                                 CurrentLongTermTrend.ToString(),
                                 SuggestedAction.ToString(),
                                 (Action == TradeAction.Unknown || Action == TradeAction.Hold) ? "" : Action.ToString(),
                                 Indicator,
                                 Motivation,
                                 Note,
                                 Math.Round(TotMoney, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(TotCoins, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(TotValue, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(SellAt, 4).ToString(CultureInfo.InvariantCulture),
                                 Math.Round(BuyAt, 4).ToString(CultureInfo.InvariantCulture)

                                 ));
        }
 /// <summary>
 /// Tracks the specified category and action using the default
 /// Analytics Tracker
 /// </summary>
 public static void TrackEvent(Category category, Action action)
 {
     TrackEvent(category, action.ToString());
 }
Пример #14
0
 public void RequestNavigate(string regionName, string source, Action <NavigationResult> navigationCallback)
 {
     cmdExec_ = MethodBase.GetCurrentMethod().Name + " " + regionName + " " + source.ToString() + " " + navigationCallback.ToString();
 }
Пример #15
0
        public static void Start(Action method, string name, bool highPriority = false)
        {
            Thread thread = new Thread(() => RunThreadWithLogging(method))
            {
                Name         = name,
                IsBackground = true,
                Priority     = highPriority ? ThreadPriority.Highest : ThreadPriority.Normal
            };

            lock (threads) {
                threads.Add(thread);
                threadTimes.Add(DateTime.UtcNow);
                threadInfos.Add($"Name: {name}\nAction: {method?.Method?.ToString() ?? method.ToString()}\nStarter:\n{new StackTrace(1)}");
            }
            Current = new WeakReference <Thread>(thread);
            thread.Start();
        }
 /// <summary>
 /// Tracks the specified category, action, label and value using the default
 /// Analytics Tracker
 /// </summary>
 public static void TrackEvent(Category category, Action action, string label, int value)
 {
     TrackEvent(category, action.ToString(), label, value);
 }
    /// <summary>
    /// Returns Correct URL of the copy or move dialog.
    /// </summary>
    /// <param name="nodeId">ID Of the node to be copied or moved</param>
    /// <param name="CurrentAction">Action which should be performed</param>
    private string GetDialogUrl(int nodeId, Action CurrentAction)
    {
        Config.CustomFormatCode = CurrentAction.ToString().ToLower();

        string url = CMSDialogHelper.GetDialogUrl(Config, false, false, null, false);

        url = URLHelper.RemoveParameterFromUrl(url, "hash");
        url = URLHelper.AddParameterToUrl(url, "sourcenodeids", nodeId.ToString());
        url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url));
        url = URLHelper.EncodeQueryString(url);

        return url;
    }
Пример #18
0
        public void     OnGUI(Rect r, float minY, float maxY, File model)
        {
            if (this.isDir == false)
            {
                return;
            }

            if (this.canDisplay == false)
            {
                GUI.Label(r, "No change detected.");
                return;
            }

            r.height = 16F;

            if (Event.current.type == EventType.Repaint &&
                r.Contains(Event.current.mousePosition) == true)
            {
                EditorGUI.DrawRect(r, File.HighlightBackground);
            }
            else if (Event.current.type == EventType.MouseMove &&
                     r.Contains(Event.current.mousePosition) == true)
            {
                Utility.RepaintEditorWindow(typeof(NGSyncFoldersWindow));
            }

            EditorGUI.BeginChangeCheck();
            this.open = EditorGUI.Foldout(r, this.open, this.name, true);
            if (EditorGUI.EndChangeCheck() == true)
            {
                this.InvalidateHeight();
            }

            if (this.open == false)
            {
                return;
            }

            r.y += r.height;

            if (r.y > maxY)
            {
                return;
            }

            float w = r.width;

            EditorGUI.indentLevel++;
            for (int i = 0; i < this.children.Count; i++)
            {
                if (this.children[i].isDir == true)
                {
                    if (this.children[i].canDisplay == true)
                    {
                        File m = this.children[i].GetCacheModel(model, this.children[i].name);
                        r.height = this.children[i].GetHeight(m);

                        if (r.yMax >= minY)
                        {
                            this.children[i].OnGUI(r, minY, maxY, m);
                        }
                        r.y += r.height;

                        if (r.y > maxY)
                        {
                            break;
                        }
                    }
                }
                else
                {
                    if (this.isMaster == true)
                    {
                        if (this.children[i].masterState != MasterState.Same)
                        {
                            r.height = 16F;

                            if (r.yMax >= minY)
                            {
                                Color color = default(Color);

                                if (this.children[i].masterState == MasterState.Created)
                                {
                                    color = NGSyncFoldersWindow.CreateColor;
                                }
                                else if (this.children[i].masterState == MasterState.Altered)
                                {
                                    color = NGSyncFoldersWindow.RestoreColor;
                                }
                                else if (this.children[i].masterState == MasterState.Deleted)
                                {
                                    color = NGSyncFoldersWindow.DeleteColor;
                                }

                                if (Event.current.type == EventType.Repaint &&
                                    r.Contains(Event.current.mousePosition) == true)
                                {
                                    EditorGUI.DrawRect(r, color);
                                }
                                else if (Event.current.type == EventType.MouseMove &&
                                         r.Contains(Event.current.mousePosition) == true)
                                {
                                    Utility.RepaintEditorWindow(typeof(NGSyncFoldersWindow));
                                }

                                EditorGUI.LabelField(r, Utility.Color(this.children[i].name, color), GeneralStyles.RichLabel);
                            }

                            r.y += r.height;

                            if (r.y > maxY)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        File   m      = this.children[i].GetCacheModel(model, this.children[i].name);
                        Action action = this.children[i].ChooseAction(m);

                        if (action != Action.Nothing)
                        {
                            r.height = 16F;

                            if (r.yMax >= minY)
                            {
                                Color color = default(Color);

                                if (action == Action.Create)
                                {
                                    color = NGSyncFoldersWindow.CreateColor;
                                }
                                else if (action == Action.Change)
                                {
                                    color = NGSyncFoldersWindow.RestoreColor;
                                }
                                else if (action == Action.Delete)
                                {
                                    color = NGSyncFoldersWindow.DeleteColor;
                                }

                                if (Event.current.type == EventType.Repaint &&
                                    r.Contains(Event.current.mousePosition) == true)
                                {
                                    EditorGUI.DrawRect(r, color * .2F);
                                }
                                else if (Event.current.type == EventType.MouseMove &&
                                         r.Contains(Event.current.mousePosition) == true)
                                {
                                    Utility.RepaintEditorWindow(typeof(NGSyncFoldersWindow));
                                }

                                r.width -= 75F;
                                if (this.children[i].actionException != null)
                                {
                                    r.width -= 75F;
                                }

                                EditorGUI.LabelField(r, Utility.Color(this.children[i].name, color), GeneralStyles.RichLabel);
                                r.x += r.width;

                                if (this.children[i].actionException != null)
                                {
                                    r.width = 75F;
                                    using (BgColorContentRestorer.Get(Color.red))
                                    {
                                        if (GUI.Button(r, "Error") == true)
                                        {
                                            ErrorPopup e = new ErrorPopup(NGSyncFoldersWindow.Title);
                                            e.exception = this.children[i].actionException;
                                            e.OpenError(r);
                                        }
                                    }
                                    r.x += r.width;
                                }

                                using (BgColorContentRestorer.Get(action == Action.Create ? NGSyncFoldersWindow.CreateColor : (action == Action.Change ? NGSyncFoldersWindow.RestoreColor : NGSyncFoldersWindow.DeleteColor)))
                                {
                                    r.width = 75F;
                                    if (GUI.Button(r, action.ToString()) == true)
                                    {
                                        this.children[i].Sync(m);
                                    }
                                    r.x -= w - 75F;
                                    if (this.actionException != null)
                                    {
                                        r.x -= 75F;
                                    }
                                    r.width = w;
                                }
                            }

                            r.y += r.height;

                            if (r.y > maxY)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            EditorGUI.indentLevel--;
        }
Пример #19
0
 /// <summary>
 /// Modify the relationship between the current user and the target user.
 /// <para>
 /// <c>Requires Authentication:</c> True
 /// </para>
 /// <para>
 /// <c>Required scope:</c> relationships
 /// </para>
 /// </summary>
 /// <param name="userId">The user id about which to get relationship information.</param>
 /// <param name="action">One of Action enum.</param>
 public Task<RelationshipResponse> Relationship(int userId, Action action)
 {
     var request = base.Request(string.Format("{0}/relationship", userId.ToString()), HttpMethod.Post);
     request.Content = new FormUrlEncodedContent(new List<KeyValuePair<string, string>>() { new KeyValuePair<string, string>("action", action.ToString().ToLower()) });
     return base.Client.ExecuteAsync<RelationshipResponse>(request);
 }
 public override string ToString()
 {
     return(Action.ToString() + " " + Mod.Name + ".  Notes: " + Notes);
 }
Пример #21
0
 public void RequestNavigate(string regionName, string target, Action <NavigationResult> navigationCallback, NavigationParameters navigationParameters)
 {
     cmdExec_ = MethodBase.GetCurrentMethod().Name + " " + regionName + " " + target.ToString() + " " + navigationCallback.ToString() + " " + navigationParameters.ToString();
 }
Пример #22
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="ASender"></param>
        /// <param name="AEventArgs"></param>
        public void OnThreadException(object ASender, ThreadExceptionEventArgs AEventArgs)
        {
            TUnhandledExceptionForm UEDialogue;
            string FunctionalityNotImplementedMsg = AppCoreResourcestrings.StrFunctionalityNotAvailableYet;
            string Reason = String.Empty;

            if ((AEventArgs.Exception is NotImplementedException))
            {
                if (AEventArgs.Exception.Message != String.Empty)
                {
                    FunctionalityNotImplementedMsg = AEventArgs.Exception.Message;
                }

                TLogging.Log(FunctionalityNotImplementedMsg);
                TLogging.Log(AEventArgs.Exception.StackTrace);

                MessageBox.Show(FunctionalityNotImplementedMsg, AppCoreResourcestrings.StrFunctionalityNotAvailableYetTitle,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if ((AEventArgs.Exception is EDBAccessLackingCoordinationException))
            {
                Form MainMenuForm = Application.OpenForms[0];  // This gets the first ever opened Form, which is the Main Menu

                // Ensure MessageBox is shown on the UI Thread!
                if (MainMenuForm.InvokeRequired)
                {
                    MainMenuForm.Invoke((MethodInvoker) delegate {
                        TServerBusyHelperGui.ShowDBAccessLackingActionNotPossibleDialog(
                            (EDBAccessLackingCoordinationException)AEventArgs.Exception, out Reason);
                    });
                }
                else
                {
                    TServerBusyHelperGui.ShowDBAccessLackingActionNotPossibleDialog(
                        (EDBAccessLackingCoordinationException)AEventArgs.Exception, out Reason);
                }

                if (TLogging.DebugLevel >= TLogging.DEBUGLEVEL_COORDINATED_DB_ACCESS)
                {
                    TLogging.Log(String.Format(Catalog.GetString(
                                                   TLogging.LOG_PREFIX_INFO + "The OpenPetra Server was too busy to perform the requested action. (Reason: {0})"),
                                               Reason));
                    TLogging.Log((AEventArgs.Exception).StackTrace);
                }
            }
            else if (((Exception)AEventArgs.Exception is ECachedDataTableLoadingRetryGotCancelledException))
            {
                if (TLogging.DebugLevel >= TLogging.DEBUGLEVEL_COORDINATED_DB_ACCESS)
                {
                    TLogging.Log(Catalog.GetString(
                                     TLogging.LOG_PREFIX_INFO +
                                     "The OpenPetra Server was too busy to retrieve the data for a Cacheable DataTable and the user cancelled the loading after the retry attempts were exhausted."));
                    TLogging.Log(((Exception)AEventArgs.Exception).StackTrace);
                }

                TServerBusyHelperGui.ShowLoadingOfDataGotCancelledDialog();
            }
            else if ((AEventArgs.Exception is ESecurityAccessDeniedException))
            {
                if (ProcessSecurityAccessDeniedException != null)
                {
                    ProcessSecurityAccessDeniedException((ESecurityAccessDeniedException)AEventArgs.Exception, ASender.GetType());
                }
                else
                {
                    MessageBox.Show(
                        "Unhandled Thread Exception Handler: encountered ESecurityAccessDeniedException, but Delegate " +
                        "'ProcessSecurityAccessDeniedException' isn't set up - which is a mistake that needs to be corrected." +
                        Environment.NewLine +
                        "Message of the ProcessSecurityAccessDeniedException instance:" + Environment.NewLine +
                        ProcessSecurityAccessDeniedException.ToString());
                }
            }
            else
            {
//                MessageBox.Show(
//                    "TUnhandledThreadExceptionHandler.OnThreadException  Unhandled Exception: \r\n\r\n" + AEventArgs.Exception.ToString());

                ExceptionHandling.LogException(AEventArgs.Exception, "Reported by TUnhandledThreadExceptionHandler.OnThreadException");
                UEDialogue = new TUnhandledExceptionForm();

                UEDialogue.NonRecoverable = false;
                UEDialogue.TheException   = AEventArgs.Exception;

                Form MainMenuForm = Application.OpenForms[0];  // This gets the first ever opened Form, which is the Main Menu

                // Ensure UEDialogue is shown on the UI Thread!
                if (MainMenuForm.InvokeRequired)
                {
                    MainMenuForm.Invoke((MethodInvoker) delegate { UEDialogue.ShowDialog(); });
                }
                else
                {
                    UEDialogue.ShowDialog();
                }
            }
        }
Пример #23
0
 public override string ToString() => "Самолет -" + Type.ToString() + ", вылет/прилет - " + Action.ToString() + ", время - " + Date.ToString() + ", город - " + Sity.ToString() + "\nСвободных мест:" + (Capasity - Passenger).ToString() + "/" + Capasity;
 /// <summary>
 /// Add an action into the tracking list
 /// </summary>
 public static void TrackAction(Action action)
 {
     if(isTrackingStarted && !isTrackingPuased)
     {
         //update end time
         action.EndTime = timeFromStart;
         actions.Enqueue (action);
         Debug.Log(string.Format("New Tracking Action ({0}) Added on {1}s!",action.ToString(),timeFromStart));
     }
 }
        public List <CPluginVariable> GetDisplayPluginVariables()
        {
            var list = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Commands + VariableName.PunishCommand, typeof(string[]), _punishCommand),
                new CPluginVariable(VariableGroup.Commands + VariableName.ForgiveCommand, typeof(string[]), _forgiveCommand),
                new CPluginVariable(VariableGroup.Commands + VariableName.AllowKillersToApologizeToAvoidPunishment, typeof(enumBoolYesNo), _allowKillersToApologizeToAvoidPunishment),
                new CPluginVariable(VariableGroup.Commands + VariableName.ShameCommand, typeof(string[]), _shameCommand),
                new CPluginVariable(VariableGroup.Messages + VariableName.KillerMessages, typeof(string[]), _killerMessages),
                new CPluginVariable(VariableGroup.Messages + VariableName.VictimMessages, typeof(string[]), _victimMessages),
                new CPluginVariable(VariableGroup.Messages + VariableName.PunishedMessage, typeof(string), _punishedMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.ForgivenMessage, typeof(string), _forgivenMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.ApologizedMessage, typeof(string), _apologizedMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.KickMessage, typeof(string), _kickMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToPunishMessage, typeof(string), _noOneToPunishMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToForgiveMessage, typeof(string), _noOneToForgiveMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToApologizeToMessage, typeof(string), _noOneToApologizeToMessage),
                new CPluginVariable(VariableGroup.Messages + VariableName.ShameAllOnRoundEnd, typeof(enumBoolYesNo), _shameAllOnRoundEnd),
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToShameMessage, typeof(string), _noOneToShameMessage),
                new CPluginVariable(VariableGroup.Limits + VariableName.VictimWindow, typeof(int), _victimWindow.TotalSeconds),
                new CPluginVariable(VariableGroup.Limits + VariableName.AutoAction, CreateEnumString(typeof(Action)), _autoAction.ToString()),
                new CPluginVariable(VariableGroup.Limits + VariableName.HasPunishLimit, CreateEnumString(typeof(enumBoolYesNo)), _hasPunishLimit.ToString()),
                new CPluginVariable(VariableGroup.Protection + VariableName.Protected, CreateEnumString(typeof(Protect)), _protect.ToString()),
                new CPluginVariable(VariableGroup.Debug + VariableName.ShouldSuicideCountAsATeamKill, typeof(enumBoolYesNo), _shouldSuicideCountAsATeamKill),
                new CPluginVariable(VariableGroup.Debug + VariableName.OutputToChat, CreateEnumString(typeof(Chat)), _outputToChat.ToString()),
                new CPluginVariable(VariableGroup.Protection + VariableName.UseAdKats, typeof(enumBoolYesNo), _useAdKats),
            };

            // Sorry

            var insertAt = list.FindIndex(v => v.Name.EndsWith(VariableName.AllowKillersToApologizeToAvoidPunishment)) + 1;

            var sorry = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Commands + VariableName.SorryCommand, typeof(string[]), _sorryCommand)
            };

            if (_allowKillersToApologizeToAvoidPunishment == enumBoolYesNo.Yes)
            {
                list.InsertRange(insertAt, sorry);
            }

            // Shame

            insertAt = list.FindIndex(v => v.Name.EndsWith(VariableName.ShameAllOnRoundEnd)) + 1;

            var shame = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Messages + VariableName.NoOneToShameOnRoundEndMessage, typeof(string), _noOneToShameOnRoundEndMessage)
            };

            if (_shameAllOnRoundEnd == enumBoolYesNo.Yes)
            {
                list.InsertRange(insertAt, shame);
            }

            // Limits

            insertAt = list.FindIndex(v => v.Name.EndsWith(VariableName.HasPunishLimit)) + 1;

            var limits = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Limits + VariableName.PunishLimit, typeof(int), _punishLimit),
                new CPluginVariable(VariableGroup.Limits + VariableName.PlayerCountThresholdForKick, typeof(int), _playerCountThresholdForKick)
            };

            if (_hasPunishLimit == enumBoolYesNo.Yes)
            {
                list.InsertRange(insertAt, limits);
            }

            // Protection

            insertAt = list.FindIndex(v => v.Name.EndsWith(VariableName.Protected)) + 1;

            var whitelist = new List <CPluginVariable>
            {
                new CPluginVariable(VariableGroup.Protection + VariableName.Whitelist, typeof(string[]), _whitelist)
            };

            if (_protect == Protect.Whitelist || _protect == Protect.AdminsAndWhitelist)
            {
                list.InsertRange(insertAt, whitelist);
            }

            return(list);
        }
        public static void Send(Category category, Action action, String label)
        {
            String cid = GoogleOgcs.Authenticator.HashedGmailAccount ?? "1";
            String baseAnalyticsUrl = "https://www.google-analytics.com/collect?v=1&t=event&tid=UA-19426033-4&cid=" + cid;

            String analyticsUrl = baseAnalyticsUrl + "&ec=" + category.ToString() + "&ea=" + action.ToString() + "&el=" + System.Net.WebUtility.UrlEncode(label);

            log.Debug("Retrieving URL: " + analyticsUrl);
            if (System.Diagnostics.Debugger.IsAttached)
            {
                return;
            }

            WebClient wc = new WebClient();

            wc.Headers.Add("user-agent", Settings.Instance.Proxy.BrowserUserAgent);
            wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(sendTelemetry_completed);
            wc.DownloadStringAsync(new Uri(analyticsUrl), analyticsUrl);
        }
Пример #27
0
 public override string ToString()
 {
     return(string.Concat("rect=", rect, ", faction=", (faction != null) ? faction.ToString() : "null", ", custom=", (custom != null) ? custom.Count.ToString() : "null", ", pawnGroupMakerParams=", (pawnGroupMakerParams != null) ? pawnGroupMakerParams.ToString() : "null", ", pawnGroupKindDef=", (pawnGroupKindDef != null) ? pawnGroupKindDef.ToString() : "null", ", roofDef=", (roofDef != null) ? roofDef.ToString() : "null", ", noRoof=", noRoof.HasValue ? noRoof.ToString() : "null", ", addRoomCenterToRootsToUnfog=", addRoomCenterToRootsToUnfog.HasValue ? addRoomCenterToRootsToUnfog.ToString() : "null", ", singleThingToSpawn=", (singleThingToSpawn != null) ? singleThingToSpawn.ToString() : "null", ", singleThingDef=", (singleThingDef != null) ? singleThingDef.ToString() : "null", ", singleThingStuff=", (singleThingStuff != null) ? singleThingStuff.ToString() : "null", ", singleThingStackCount=", singleThingStackCount.HasValue ? singleThingStackCount.ToString() : "null", ", skipSingleThingIfHasToWipeBuildingOrDoesntFit=", skipSingleThingIfHasToWipeBuildingOrDoesntFit.HasValue ? skipSingleThingIfHasToWipeBuildingOrDoesntFit.ToString() : "null", ", spawnBridgeIfTerrainCantSupportThing=", spawnBridgeIfTerrainCantSupportThing.HasValue ? spawnBridgeIfTerrainCantSupportThing.ToString() : "null", ", singlePawnToSpawn=", (singlePawnToSpawn != null) ? singlePawnToSpawn.ToString() : "null", ", singlePawnKindDef=", (singlePawnKindDef != null) ? singlePawnKindDef.ToString() : "null", ", disableSinglePawn=", disableSinglePawn.HasValue ? disableSinglePawn.ToString() : "null", ", singlePawnLord=", (singlePawnLord != null) ? singlePawnLord.ToString() : "null", ", singlePawnSpawnCellExtraPredicate=", (singlePawnSpawnCellExtraPredicate != null) ? singlePawnSpawnCellExtraPredicate.ToString() : "null", ", singlePawnGenerationRequest=", singlePawnGenerationRequest.HasValue ? singlePawnGenerationRequest.ToString() : "null", ", postThingSpawn=", (postThingSpawn != null) ? postThingSpawn.ToString() : "null", ", postThingGenerate=", (postThingGenerate != null) ? postThingGenerate.ToString() : "null", ", mechanoidsCount=", mechanoidsCount.HasValue ? mechanoidsCount.ToString() : "null", ", hivesCount=", hivesCount.HasValue ? hivesCount.ToString() : "null", ", disableHives=", disableHives.HasValue ? disableHives.ToString() : "null", ", thingRot=", thingRot.HasValue ? thingRot.ToString() : "null", ", wallStuff=", (wallStuff != null) ? wallStuff.ToString() : "null", ", chanceToSkipWallBlock=", chanceToSkipWallBlock.HasValue ? chanceToSkipWallBlock.ToString() : "null", ", floorDef=", (floorDef != null) ? floorDef.ToString() : "null", ", chanceToSkipFloor=", chanceToSkipFloor.HasValue ? chanceToSkipFloor.ToString() : "null", ", filthDef=", (filthDef != null) ? filthDef.ToString() : "null", ", filthDensity=", filthDensity.HasValue ? filthDensity.ToString() : "null", ", floorOnlyIfTerrainSupports=", floorOnlyIfTerrainSupports.HasValue ? floorOnlyIfTerrainSupports.ToString() : "null", ", allowBridgeOnAnyImpassableTerrain=", allowBridgeOnAnyImpassableTerrain.HasValue ? allowBridgeOnAnyImpassableTerrain.ToString() : "null", ", clearEdificeOnly=", clearEdificeOnly.HasValue ? clearEdificeOnly.ToString() : "null", ", clearFillageOnly=", clearFillageOnly.HasValue ? clearFillageOnly.ToString() : "null", ", clearRoof=", clearRoof.HasValue ? clearRoof.ToString() : "null", ", ancientCryptosleepCasketGroupID=", ancientCryptosleepCasketGroupID.HasValue ? ancientCryptosleepCasketGroupID.ToString() : "null", ", podContentsType=", podContentsType.HasValue ? podContentsType.ToString() : "null", ", thingSetMakerDef=", (thingSetMakerDef != null) ? thingSetMakerDef.ToString() : "null", ", thingSetMakerParams=", thingSetMakerParams.HasValue ? thingSetMakerParams.ToString() : "null", ", stockpileConcreteContents=", (stockpileConcreteContents != null) ? stockpileConcreteContents.Count.ToString() : "null", ", stockpileMarketValue=", stockpileMarketValue.HasValue ? stockpileMarketValue.ToString() : "null", ", innerStockpileSize=", innerStockpileSize.HasValue ? innerStockpileSize.ToString() : "null", ", edgeDefenseWidth=", edgeDefenseWidth.HasValue ? edgeDefenseWidth.ToString() : "null", ", edgeDefenseTurretsCount=", edgeDefenseTurretsCount.HasValue ? edgeDefenseTurretsCount.ToString() : "null", ", edgeDefenseMortarsCount=", edgeDefenseMortarsCount.HasValue ? edgeDefenseMortarsCount.ToString() : "null", ", edgeDefenseGuardsCount=", edgeDefenseGuardsCount.HasValue ? edgeDefenseGuardsCount.ToString() : "null", ", mortarDef=", (mortarDef != null) ? mortarDef.ToString() : "null", ", pathwayFloorDef=", (pathwayFloorDef != null) ? pathwayFloorDef.ToString() : "null", ", cultivatedPlantDef=", (cultivatedPlantDef != null) ? cultivatedPlantDef.ToString() : "null", ", fillWithThingsPadding=", fillWithThingsPadding.HasValue ? fillWithThingsPadding.ToString() : "null", ", settlementPawnGroupPoints=", settlementPawnGroupPoints.HasValue ? settlementPawnGroupPoints.ToString() : "null", ", settlementPawnGroupSeed=", settlementPawnGroupSeed.HasValue ? settlementPawnGroupSeed.ToString() : "null", ", streetHorizontal=", streetHorizontal.HasValue ? streetHorizontal.ToString() : "null", ", edgeThingAvoidOtherEdgeThings=", edgeThingAvoidOtherEdgeThings.HasValue ? edgeThingAvoidOtherEdgeThings.ToString() : "null", ", edgeThingMustReachMapEdge=", edgeThingMustReachMapEdge.HasValue ? edgeThingMustReachMapEdge.ToString() : "null", ", allowPlacementOffEdge=", allowPlacementOffEdge.HasValue ? allowPlacementOffEdge.ToString() : "null", ", thrustAxis=", thrustAxis.HasValue ? thrustAxis.ToString() : "null", ", makeWarningLetter=", makeWarningLetter.HasValue ? makeWarningLetter.ToString() : "null", ", allowedMonumentThings=", (allowedMonumentThings != null) ? allowedMonumentThings.ToString() : "null"));
 }
Пример #28
0
 /// <summary>
 /// Convert to a string of the format ... #{rev} change {change} {action} on {date} {user}@{client} (type) '{desc}'
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(String.Format("... #{0} change {1} {2} {3}: {2}",
                          Revision, Date.ToShortDateString(), ChangelistId,
                          Action.ToString("F"), Description.TrimEnd('\n', '\r')));
 }
Пример #29
0
 public bool GetKey(Action action)
 {
     foreach (KeyCode keyCode in GetKeyCodes(action))
     {
         if (Input.GetKey(keyCode))
         {
             if (debug)
             {
                 Debug.Log(string.Format("Key {0} held to perform {1}.", GetKeyString(action), action.ToString()));
             }
             return(true);
         }
     }
     return(false);
 }
Пример #30
0
        internal String GetCommand(RenderContext context, Boolean indirect = false, String argument = null)
        {
            switch (Command)
            {
            case CommandType.Unknown:
                throw new NotImplementedException($"Command required for BindCmd extension");

            case CommandType.Refresh:
            case CommandType.Reload:
                return($"$reload({CommandArgument(context, nullable: true)})");

            case CommandType.Requery:
                return("$requery()");

            case CommandType.Save:
                return($"$save({{toast: {GetToast(context)}, options:{GetOptionsValid(context)}}})");

            case CommandType.Clear:
                return($"{CommandArgument(context)}.$empty()");

            case CommandType.Close:
                return(context.IsDialog ? "$modalClose()" : "$close()");

            case CommandType.CloseOk:
                return(context.IsDialog ? "$modalClose(true)" : throw new XamlException("The command 'CloseOk' is allowed for Dialogs only"));

            case CommandType.SaveAndClose:
                if (context.IsDialog)
                {
                    return($"$modalSaveAndClose(null, {GetOptionsValid(context)})");
                }
                return($"$saveAndClose({{toast: {GetToast(context)}}})");

            case CommandType.OpenSelected:
                return($"$openSelected({CommandUrl(context, decorate: true)}, {CommandArgument(context)}, {NewWindowJS}, {UpdateAfterArgument(context)})");


            case CommandType.Select:
                return($"$modalSelect({CommandArgument(context)}, {GetOptionsValid(context)})");

            case CommandType.SelectChecked:
                return($"$modalSelectChecked({CommandArgument(context)})");

            case CommandType.RemoveSelected:
                return($"$removeSelected({CommandArgument(context)}, {GetConfirm(context)})");

            case CommandType.DbRemove:
                return($"$dbRemove({CommandArgument(context)}, {GetConfirm(context)})");

            case CommandType.DbRemoveSelected:
                return($"$dbRemoveSelected({CommandArgument(context)}, {GetConfirm(context)})");


            case CommandType.MailTo:
                return(null);

            case CommandType.Navigate:
                return($"$navigateSimple({CommandUrl(context)}, {NewWindowJS})");

            case CommandType.NavigateExternal:
                return($"$navigateExternal({CommandUrl(context, decorate:false, skipCheck:true)}, {NewWindowJS})");

            case CommandType.Download:
                return($"$download({CommandUrl(context)})");

            case CommandType.Help:
                return($"$showHelp({CommandUrl(context)})");

            case CommandType.Open:
                if (indirect)
                {
                    var argSting = "this";
                    if (!IsArgumentEmpty(context))
                    {
                        argSting = CommandArgument(context);
                    }
                    // arg4 may contain a single quote!!!
                    return($"{{cmd:$navigate, eval: true, arg1:{CommandUrl(context, true)}, arg2:'{argSting}', arg3:{NewWindowJS}, arg4:{UpdateAfterArgument(context)}}}");
                }
                else
                {
                    return($"$navigate({CommandUrl(context)}, {CommandArgument(context)}, {NewWindowJS}, {UpdateAfterArgument(context)})");
                }

            case CommandType.Create:
                return($"$navigate({CommandUrl(context)}, {CommandArgument(context, nullable:true)}, {NewWindowJS}, {UpdateAfterArgument(context)}, {GetOptions(context)})");

            case CommandType.Remove:
                if (indirect)
                {
                    return($"{{cmd:$remove, arg1:'this'}}");
                }
                else
                {
                    return($"$remove({CommandArgumentOrThis(context)}, {GetConfirm(context)})");
                }

            case CommandType.Append:
                return($"{CommandArgument(context)}.$append()");

            case CommandType.Prepend:
                return($"{CommandArgument(context)}.$prepend()");

            case CommandType.Browse:
                return($"$dialog('browse', {CommandUrl(context)}, {CommandArgument(context)}, {GetData(context)})");

            case CommandType.Execute:
                if (indirect)
                {
                    if (!IsArgumentEmpty(context))
                    {
                        return($"{{cmd:$exec, arg1:'{GetName()}', arg2:'{CommandArgument(context)}'}}");
                    }
                    return($"{{cmd:$exec, arg1:'{GetName()}', arg2:'this'}}");
                }
                if (argument != null)
                {
                    return($"$exec('{GetName()}', {argument}, {GetConfirm(context)}, {GetOptions(context)})");
                }
                return($"$exec('{GetName()}', {CommandArgument(context, nullable: true)}, {GetConfirm(context)}, {GetOptions(context)})");

            case CommandType.ExecuteSelected:
                return($"$execSelected('{GetName()}', {CommandArgument(context)}, {GetConfirm(context)})");

            case CommandType.Report:
                return($"$report('{GetReportName()}', {CommandArgument(context, nullable: true)}, {GetOptions(context)})");

            case CommandType.Export:
                return($"$export()");

            case CommandType.Dialog:
                if (Action == DialogAction.Unknown)
                {
                    throw new XamlException($"Action required for {Command} command");
                }
                String  action    = Action.ToString().ToKebabCase();
                Boolean bNullable = false;
                if (Action == DialogAction.Show)
                {
                    bNullable = true;                             // Nullable actions ???
                }
                if (indirect)
                {
                    String arg3 = "this";
                    if (!IsArgumentEmpty(context))
                    {
                        arg3 = CommandArgument(context);
                    }
                    // command, url, data
                    return($"{{cmd:$dialog, isDialog:true, arg1:'{action}', arg2:{CommandUrl(context, decorate:true)}, arg3: '{arg3}'}}");
                }
                return($"$dialog('{action}', {CommandUrl(context)}, {CommandArgument(context, bNullable)}, {GetData(context)}, {GetOptions(context)})");

            default:
                throw new NotImplementedException($"command '{Command}' yet not implemented");
            }
        }
Пример #31
0
	public void Change(Action a)
	{
		CurrentAction = a;
		anim.Play(a.ToString());
	}
Пример #32
0
 private static void StartThread(Action threadAction)
 {
     Debug.WriteLine("StartThread: " + threadAction.ToString());
     // uncomment this line to enable background task start
     new Thread(() => threadAction()).Start();
 }
Пример #33
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <returns>操作的方法及操作的信息</returns>
        public string Execute()
        {
            new SqlMessage().Operation(_action, _mm);

            return(_action.ToString() + ":" + _mm.Message);
        }
Пример #34
0
    public override void ExitCamera()
    {
        LogB.Information("Exit camera");
        LogB.Information("streamWriter is null: " + (streamWriter == null).ToString());
        LogB.Information("Action: " + action.ToString());

        if (action == Action.PLAYPREVIEW || action == Action.PLAYFILE)
        {
            LogB.Information("killing ...");
            try {
                process.Kill();
            }
            catch {
                LogB.Information("catched!");
            }
            LogB.Information("done!");
        }
        else
        {         //action == Action.CAPTURE
            try {
                streamWriter.Write('q');
                streamWriter.Flush();                 //seems is not needed
            } catch {
                //maybe capturer process (could be a window) has been closed by user
                process = null;
                Running = false;
                return;
            }

            LogB.Information("closing ...");
            process.Close();
            LogB.Information("done!");
        }

        if (action == Action.CAPTURE)
        {
            /*
             * above process.Close() will end the process
             * without using this file copied from /tmp maybe is not finished, so a bad ended file is copied to .local/share/Chronojump/multimedia/video
             */

            bool exitBucle = false;
            do
            {
                LogB.Information("waiting 100 ms to tmp capture file being unlocked");
                System.Threading.Thread.Sleep(100);

                if (!File.Exists(Util.GetVideoTempFileName()))                  //PlayPreview does not have tmp file
                {
                    exitBucle = true;
                }
                else if (!ExecuteProcess.IsFileLocked(new System.IO.FileInfo(Util.GetVideoTempFileName())))                   //we are capturing, wait file is not locked
                {
                    exitBucle = true;
                }
            } while(!exitBucle);

            do
            {
                LogB.Information("waiting 100 ms to end Ffmpeg");
                System.Threading.Thread.Sleep(100);
            } while(ExecuteProcess.IsRunning3(processID, "ffmpeg"));             //note on Linux and Windows we need to check ffmpeg and not ffmpeg.exe
        }

        streamWriter = null;
        process      = null;
        Running      = false;
    }
Пример #35
0
	internal void UnregisterEventListener(object aListener, Action<EventObject> aMethod = null)
	{
	    int index = 0;
	    bool eventRemoved = false;

	    while (!eventRemoved)
	    {
	        if (index >= _listenerList.Count)
	        {
	            break;
	        }

	        ListenerObject listener = _listenerList[index];
	        if ((listener.ObjectReference.Equals(aListener) && aMethod != null && listener.Callback.Equals(aMethod)) ||
	            (listener.ObjectReference.Equals(aListener) && aMethod == null))
	        {
	            UnregisterEventListenerObject(listener);
	            eventRemoved = true;
	        }
	        else
	        {
	            if (listener.IsAlive)
	            {
	                index++;
	            }
	            else
	            {
	                UnregisterEventListenerObject(listener);
	            }
	        }
	    }

	    if (!eventRemoved)
	    {
	        string prefix = "";
	        if (aMethod != null)
	        {
	            prefix += "The method [" + aMethod.ToString() + "] from ";
	        }
	        Debug.LogWarning("[EventObject.cs] - UnregisterEventListener() - " + prefix + aListener.ToString() + "] doesn't seem to be registered for the event: " + _event + ".");
	    }

	    if (_listenerList.Count <= 0)
	    {
	        Destroy();
	    }
	}
        public void NewAction(Action nextAction)
        {
            Debug.Log(string.Concat(new string[]
            {
                "new action: ",
                nextAction.ToString(),
                " (from ",
                this.action.ToString(),
                ")"
            }));
            if (nextAction == this.action)
            {
                return;
            }
            SubBehavior.SubBehavID subBehavID;
            switch (nextAction)
            {
            case Action.MeetWhite_Shocked:
            case Action.MeetWhite_Curious:
            case Action.MeetWhite_Talking:
            case Action.MeetWhite_Texting:
            case Action.MeetWhite_Images:
            case Action.MeetWhite_SecondCurious:
                subBehavID = SubBehavior.SubBehavID.MeetWhite;
                break;

            case Action.MeetYellow_Init:
                subBehavID = SubBehavior.SubBehavID.MeetYellow;
                break;

            case Action.MeetRed_Init:
                subBehavID = SubBehavior.SubBehavID.MeetRed;
                break;

            case Action.GetNeuron_Init:
            case Action.GetNeuron_TakeNeuron:
            case Action.GetNeuron_GetOutOfStomach:
            case Action.GetNeuron_InspectNeuron:
                subBehavID = SubBehavior.SubBehavID.GetNeuron;
                break;

            case Action.ThrowOut_ThrowOut:
            case Action.ThrowOut_SecondThrowOut:
            case Action.ThrowOut_KillOnSight:
            case Action.ThrowOut_Polite_ThrowOut:
                subBehavID = SubBehavior.SubBehavID.ThrowOut;
                break;

            default:
                subBehavID = SubBehavior.SubBehavID.General;
                break;
            }
            this.currSubBehavior.NewAction(this.action, nextAction);
            if (subBehavID != SubBehavior.SubBehavID.General && subBehavID != this.currSubBehavior.ID)
            {
                SubBehavior subBehavior = null;
                for (int i = 0; i < this.allSubBehaviors.Count; i++)
                {
                    if (this.allSubBehaviors[i].ID == subBehavID)
                    {
                        subBehavior = this.allSubBehaviors[i];
                        break;
                    }
                }
                if (subBehavior == null)
                {
                    subBehavior = new NoSubBehavior(this);
                    this.allSubBehaviors.Add(subBehavior);
                }
                subBehavior.Activate(this.action, nextAction);
                this.currSubBehavior.Deactivate();
                Debug.Log("Switching subbehavior to: " + subBehavior.ID.ToString() + " from: " + this.currSubBehavior.ID.ToString());
                this.currSubBehavior = subBehavior;
            }
            this.inActionCounter = 0;
            this.action          = nextAction;
        }
Пример #37
0
 public static void LogAction(int originId, int targetId, Action action)
 {
     LoggedEvents.Add(new ActionEventInfo(originId, targetId, action.ToString(), action.GetValue()));
 }
Пример #38
0
 public override string ToString()
 {
     return(m_TimerUpdateEvent.ToString());
 }
Пример #39
0
 public override string ToString()
 {
     return($"{_action.ToString()}: {_message}");
 }
Пример #40
0
 /// <summary>
 /// Modify the relationship between the current user and the target user.
 /// <para><c>Requires Authentication:</c> True
 /// </para><para><c>Required scope:</c> relationships
 /// </para>
 /// </summary>
 /// <param name="userId">The user id about which to get relationship information.</param>
 /// <param name="action">One of Action enum.</param>
 /// <returns>RelationshipResponse</returns>
 public Task<RelationshipResponse> Relationship(long userId, Action action)
 {
     var request = Request("{id}/relationship", HttpMethod.Post);
     request.AddUrlSegment("id", userId.ToString());
     request.Content = new FormUrlEncodedContent(new List<KeyValuePair<string, string>>
     {
         new KeyValuePair<string, string>("action", action.ToString().ToLower())
     });
     return Client.ExecuteAsync<RelationshipResponse>(request);
 }
Пример #41
0
 /// <summary>Convert an <c>Action</c> to string, useful for file representation</summary>
 public static string ToString(this Action a)
 {
     return(a.ToString().ToLower());
 }
Пример #42
0
 public void Notify(Note note, Action action)
 {
     OnChanged?.Invoke($"Scrapbook update. {note:TC} was {action.ToString().ToUpper()}.");
 }
Пример #43
0
        /// <summary>
        /// the active player folds, checks, calls, bets, raises with this function
        /// </summary>
        /// <param name="pa"> the action which the player can do</param>
        /// <param name="amount">absolut amount(fold - 0; check - 0)</param>
        public void activeAction(Action.playerAction pa, int amount)
        {
            log.Debug("activeAction(Action.playerAction "+ pa.ToString() +",int " + amount + ") - Begin");
            switch (pa)
            {
                case Action.playerAction.fold:
                    activePlayer.isActive = false;
                    activePlayer.totalInPot += activePlayer.inPot;
                    activePlayer.inPot = 0;
                    activePlayer.cards = new List<Card>();
                    break;

                case Action.playerAction.check:

                    break;
                case Action.playerAction.call:
                    pot.raisePot(activePlayer, amount);
                    activePlayer.action(amount);
                    break;
                case Action.playerAction.bet:
                    pot.amountPerPlayer = amount + activePlayer.inPot;
                    pot.raisePot(activePlayer, amount);
                    activePlayer.action(amount);
                    pot.raiseSize = amount;
                    break;
                case Action.playerAction.raise:
                    pot.raiseSize = amount - pot.amountPerPlayer + activePlayer.inPot;
                    if (pot.sidePot == null)
                    {
                        pot.amountPerPlayer = amount + activePlayer.inPot;
                    }
                    else
                    {
                        pot.amountPerPlayer = amount + activePlayer.inPot - pot.sidePot.amountPerPlayer;
                    }
                    pot.raisePot(activePlayer,  amount);
                    activePlayer.action(amount);
                    break;
            }
            Logger.action(this, activePlayer, pa, amount, this.board);
            activePlayer.hasChecked = true;
            log.Debug("activeAction() - End");
        }