コード例 #1
0
            /// <summary>
            /// Deliver me
            /// </summary>
            /// <param name="Message">Text</param>
            /// <param name="Channel">Channel</param>
            /// <param name="Pr">Priority</param>
            public void DeliverAct(string Message, string Channel, priority Pr = priority.normal)
            {
                // first of all we check if we are in correct instance
                if (Channel.StartsWith("#"))
                {
                    config.channel ch = core.getChannel(Channel);
                    if (ch == null)
                    {
                        core.Log("Not sending message to unknown channel: " + Channel);
                        return;
                    }
                    // this is wrong instance so let's put this message to correct one
                    if (ch.instance != Parent.ParentInstance)
                    {
                        ch.instance.irc._SlowQueue.DeliverAct(Message, Channel, Pr);
                        return;
                    }
                }
                Message text = new Message {
                    _Priority = Pr, message = Message, channel = Channel
                };

                lock (messages)
                {
                    messages.Add(text);
                }
            }
コード例 #2
0
 public ActionsToDo(action targetAction, int targetObjectTypeID, priority targetPriority, parameters targetParameters)
 {
     _action       = targetAction;
     _priority     = targetPriority;
     _objectTypeID = targetObjectTypeID;
     _parameters   = targetParameters;
 }
コード例 #3
0
        public ActionResult DeleteConfirmed(byte id)
        {
            priority priority = db.priorities.Find(id);

            db.priorities.Remove(priority);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "id,priorityname")] priority priority)
 {
     if (ModelState.IsValid)
     {
         db.Entry(priority).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(priority));
 }
コード例 #5
0
ファイル: Part.cs プロジェクト: bivvend/Gen_Pack
 public Part()
 {
     this.position_x         = 0.0d;
     this.position_y         = 0.0d;
     this.is_placed          = true;
     this.part_orientation   = rotation.top;
     this.placement_priority = priority.normal;
     this.clashes            = false;
     this.border_mm          = 0.0d;
 }
コード例 #6
0
ファイル: unitpattern.cs プロジェクト: IrTrash/trashunity1
    private bool makedecision()
    {
        candidates.AddRange(makedecisions(gatherinfo()));

        if (candidates.Count <= 0)
        {
            return(false);
        }

        switch (type)
        {
        case normalunit:
        {
            //우선도
            priority p = new priority();
            foreach (UnitAction.act c in candidates)
            {
                switch (c.type)
                {
                case "useweapon":
                {
                    p.add("unitact", c, 3);
                }
                break;

                case "movedest":
                {
                    p.add("unitact", c, 2);
                }
                break;


                default:
                {
                    p.add("unitact", c, 1);
                }
                break;
                }
            }

            decision = (UnitAction.act)p.getrandom_priority().msg;
            Debug.Log("Decision set");
        }
        break;

        case building:
        {
        }
        break;
        }

        candidates.Clear();

        return(true);
    }
コード例 #7
0
            /// <summary>
            /// Send a command to server
            /// </summary>
            /// <param name="Data"></param>
            /// <param name="Priority"></param>
            public void Send(string Data, priority Priority = priority.high)
            {
                Message text = new Message {
                    _Priority = Priority, channel = null, message = Data, command = true
                };

                lock (messages)
                {
                    messages.Add(text);
                }
            }
コード例 #8
0
            /// <summary>
            /// Deliver a message
            /// </summary>
            /// <param name="Message">Text</param>
            /// <param name="User">User</param>
            /// <param name="Pr">Priority</param>
            public void DeliverMessage(string Message, User User, priority Pr = priority.low)
            {
                Message text = new Message {
                    _Priority = Pr, message = Message, channel = User.Nick
                };

                lock (messages)
                {
                    messages.Add(text);
                }
            }
コード例 #9
0
        public ActionResult Create([Bind(Include = "id,priorityname")] priority priority)
        {
            if (ModelState.IsValid)
            {
                db.priorities.Add(priority);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(priority));
        }
コード例 #10
0
ファイル: Part.cs プロジェクト: bivvend/Gen_Pack
 public Part(double pos_x, double pos_y, double sizex, double sizey, double border, priority priority_to_set)
 {
     this.position_x         = pos_x;
     this.position_y         = pos_y;
     this.border_mm          = border;
     this.placement_priority = priority_to_set;
     this.size_x             = sizex;
     this.size_y             = sizey;
     this.is_placed          = true;
     this.clashes            = false;
 }
コード例 #11
0
        // GET: priorities/Delete/5
        public ActionResult Delete(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            priority priority = db.priorities.Find(id);

            if (priority == null)
            {
                return(HttpNotFound());
            }
            return(View(priority));
        }
コード例 #12
0
            /// <summary>
            /// Deliver a message
            /// </summary>
            /// <param name="Message">Text</param>
            /// <param name="Channel">Channel</param>
            /// <param name="Pr">Priority</param>
            public void DeliverMessage(string Message, config.channel Channel, priority Pr = priority.normal)
            {
                if (Channel == null)
                {
                    core.Log("Not sending message to unknown channel");
                    return;
                }
                // this is wrong instance so let's put this message to correct one
                if (Channel.instance != Parent.ParentInstance)
                {
                    Channel.instance.irc._SlowQueue.DeliverMessage(Message, Channel, Pr);
                    return;
                }
                Message text = new Message {
                    _Priority = Pr, message = Message, channel = Channel.Name
                };

                lock (messages)
                {
                    messages.Add(text);
                }
            }
コード例 #13
0
ファイル: UIManager.cs プロジェクト: Arkudaa/Rasmus
    /// Displays text for an (optional) amount of time, then disables the game object.
    /// Note that if you omit 'timer' it will display forever (or until it's interruped/disabled). However,
    /// passing a timer value will make it remain on screen for that time.
    public void DisplayText(string text, priority newMessagePriority = priority.highest, float timer = 0.0f)
    {
        // Compare priorities
        if ((int)newMessagePriority < (int)m_currentMessagePriority)
        {
            Debug.LogWarning("Requested message is lower than current priority message, not displaying");
            Debug.LogWarning("Not displaying: " + text);
            return;
        }

        // If another message was active and we are interrupting it, ensure we cancel the previous coroutine
        // that was created and would otherwise disable the message
        if (messageOSDTimer != null)
        {
            StopCoroutine(messageOSDTimer);
            messageOSDTimer = null;
        }

        // Update priority value
        m_currentMessagePriority = newMessagePriority;
        // Turn on the parent game object
        messageOSD.transform.parent.gameObject.SetActive(true);
        // Set the text
        messageOSD.text = text;

        // If a timer value isn't passed, we dont' trigger the coroutine so it remains active.
        // Otherwise, if a value is passed, then it'll use that in the coroutine
        if (timer > 0.0f)
        {
            messageOSDTimer = StartCoroutine(Helper.Utilities.Wait(timer, () => {
                // switch of the game object
                messageOSD.transform.parent.gameObject.SetActive(false);
                // We've stopped displaying the message, so set it to the lowest to allow other messages to be displayed
                m_currentMessagePriority = priority.lowest;
            })
                                             );
        }
    }
コード例 #14
0
 /// <summary>
 /// Deliver me
 /// </summary>
 /// <param name="Message">Text</param>
 /// <param name="Channel">Channel</param>
 /// <param name="Pr">Priority</param>
 public void DeliverAct(string Message, string Channel, priority Pr = priority.normal)
 {
     // first of all we check if we are in correct instance
     if (Channel.StartsWith("#"))
     {
         Channel ch = Core.GetChannel(Channel);
         if (ch == null)
         {
             Syslog.Log("Not sending message to unknown channel: " + Channel);
             return;
         }
         // this is wrong instance so let's put this message to correct one
         if (ch.PrimaryInstance != Parent.ParentInstance)
         {
             ch.PrimaryInstance.irc.Queue.DeliverAct(Message, Channel, Pr);
             return;
         }
     }
     Message text = new Message { MessagePriority = Pr, Text = Message, Channel = Channel };
     lock (Messages)
     {
         Messages.Add(text);
     }
 }
コード例 #15
0
ファイル: db.designer.cs プロジェクト: EdiCarlos/MyPractices
 partial void Updatepriority(priority instance);
コード例 #16
0
 public ServiceContracts(uint fileNumber, priority priority)
 {
     this.fileNumber = fileNumber;
     this.priority = priority;
 }
コード例 #17
0
ファイル: IRCcln.cs プロジェクト: Krenair/wikimedia-bot
 /// <summary>
 /// Deliver a message
 /// </summary>
 /// <param name="Message">Text</param>
 /// <param name="Channel">Channel</param>
 /// <param name="Pr">Priority</param>
 public void DeliverMessage(string Message, config.channel Channel, priority Pr = priority.normal)
 {
     if (Channel == null)
     {
         core.Log("Not sending message to unknown channel");
         return;
     }
     // this is wrong instance so let's put this message to correct one
     if (Channel.instance != Parent.ParentInstance)
     {
         Channel.instance.irc._SlowQueue.DeliverMessage(Message, Channel, Pr);
         return;
     }
     Message text = new Message { _Priority = Pr, message = Message, channel = Channel.Name };
     lock (messages)
     {
         messages.Add(text);
     }
 }
コード例 #18
0
 /// <summary>
 /// Internal function
 /// </summary>
 public void Run()
 {
     while (true)
     {
         try
         {
             if (!running)
             {
                 return;
             }
             if (messages.Count > 0)
             {
                 lock (messages)
                 {
                     newmessages.AddRange(messages);
                     messages.Clear();
                 }
             }
             if (newmessages.Count > 0)
             {
                 List <Message> Processed = new List <Message>();
                 priority       highest   = priority.low;
                 lock (newmessages)
                 {
                     while (newmessages.Count > 0)
                     {
                         // we need to get all messages that have been scheduled to be send
                         lock (messages)
                         {
                             if (messages.Count > 0)
                             {
                                 newmessages.AddRange(messages);
                                 messages.Clear();
                             }
                         }
                         highest = priority.low;
                         // we need to check the priority we need to handle first
                         foreach (Message message in newmessages)
                         {
                             if (message._Priority > highest)
                             {
                                 highest = message._Priority;
                                 if (message._Priority == priority.high)
                                 {
                                     break;
                                 }
                             }
                         }
                         // send highest priority first
                         foreach (Message message in newmessages)
                         {
                             if (message._Priority >= highest)
                             {
                                 Processed.Add(message);
                                 Transfer(message);
                                 System.Threading.Thread.Sleep(config.Interval);
                                 if (highest != priority.high)
                                 {
                                     break;
                                 }
                             }
                         }
                         foreach (Message message in Processed)
                         {
                             if (newmessages.Contains(message))
                             {
                                 newmessages.Remove(message);
                             }
                         }
                     }
                 }
                 lock (newmessages)
                 {
                     newmessages.Clear();
                 }
             }
         }
         catch (ThreadAbortException)
         {
             return;
         }
         System.Threading.Thread.Sleep(200);
     }
 }
コード例 #19
0
 /// <summary>
 /// Deliver a message
 /// </summary>
 /// <param name="Message">Text</param>
 /// <param name="User">User</param>
 /// <param name="Pr">Priority</param>
 public void DeliverMessage(string Message, User User, priority Pr = priority.low)
 {
     Message text = new Message { MessagePriority = Pr, Text = Message, Channel = User.Nick };
     lock (Messages)
     {
         Messages.Add(text);
     }
 }
コード例 #20
0
 /// <summary>
 /// Deliver a message
 /// </summary>
 /// <param name="Message">Text</param>
 /// <param name="Channel">Channel</param>
 /// <param name="Pr">Priority</param>
 public void DeliverMessage(string Message, Channel Channel, priority Pr = priority.normal)
 {
     if (Channel == null)
     {
         Syslog.Log("Not sending message to null channel");
         return;
     }
     // this is wrong instance so let's put this message to correct one
     if (Channel.PrimaryInstance != Parent.ParentInstance)
     {
         Channel.PrimaryInstance.irc.Queue.DeliverMessage(Message, Channel, Pr);
         return;
     }
     Message text = new Message { MessagePriority = Pr, Text = Message, pChannel = Channel };
     lock (Messages)
     {
         Messages.Add(text);
     }
 }
コード例 #21
0
 /// <summary>
 /// Send a command to server
 /// </summary>
 /// <param name="Data"></param>
 /// <param name="Priority"></param>
 public void Send(string Data, priority Priority = priority.high)
 {
     Message text = new Message { MessagePriority = Priority, Channel = null, Text = Data, Command = true };
     lock (Messages)
     {
         Messages.Add(text);
     }
 }
コード例 #22
0
ファイル: IRCcln.cs プロジェクト: Krenair/wikimedia-bot
 /// <summary>
 /// Send a command to server
 /// </summary>
 /// <param name="Data"></param>
 /// <param name="Priority"></param>
 public void Send(string Data, priority Priority = priority.high)
 {
     Message text = new Message { _Priority = Priority, channel = null, message = Data, command = true };
     lock (messages)
     {
         messages.Add(text);
     }
 }
コード例 #23
0
ファイル: IRCcln.cs プロジェクト: Krenair/wikimedia-bot
 /// <summary>
 /// Deliver a message
 /// </summary>
 /// <param name="Message">Text</param>
 /// <param name="Channel">Channel</param>
 /// <param name="Pr">Priority</param>
 public void DeliverMessage(string Message, string Channel, priority Pr = priority.normal)
 {
     // first of all we check if we are in correct instance
     if (Channel.StartsWith("#"))
     {
         config.channel ch = core.getChannel(Channel);
         if (ch == null)
         {
             core.Log("Not sending message to unknown channel: " + Channel);
             return;
         }
         // this is wrong instance so let's put this message to correct one
         if (ch.instance != Parent.ParentInstance)
         {
             ch.instance.irc._SlowQueue.DeliverMessage(Message, Channel, Pr);
             return;
         }
     }
     else
     {
         lock (core.TargetBuffer)
         {
             if (core.TargetBuffer.ContainsKey(Channel))
             {
                 if (core.TargetBuffer[Channel] != Parent.ParentInstance)
                 {
                     core.TargetBuffer[Channel].irc._SlowQueue.DeliverMessage(Message, Channel, Pr);
                     return;
                 }
             }
         }
     }
     Message text = new Message { _Priority = Pr, message = Message, channel = Channel };
     lock (messages)
     {
         messages.Add(text);
     }
 }
コード例 #24
0
ファイル: IRCcln.cs プロジェクト: atdt/wikimedia-bot
 /// <summary>
 /// Deliver a message
 /// </summary>
 /// <param name="Message">Text</param>
 /// <param name="Channel">Channel</param>
 /// <param name="Pr">Priority</param>
 public void DeliverMessage(string Message, config.channel Channel, priority Pr = priority.normal)
 {
     Message text = new Message();
     text._Priority = Pr;
     text.message = Message;
     text.channel = Channel.Name;
     lock (messages)
     {
         messages.Add(text);
         return;
     }
 }
コード例 #25
0
ファイル: IRCcln.cs プロジェクト: atdt/wikimedia-bot
 /// <summary>
 /// Deliver a message
 /// </summary>
 /// <param name="Message">Text</param>
 /// <param name="User">User</param>
 /// <param name="Pr">Priority</param>
 public void DeliverMessage(string Message, User User, priority Pr = priority.low)
 {
     Message text = new Message();
     text._Priority = Pr;
     text.message = Message;
     text.channel = User.Nick;
     lock (messages)
     {
         messages.Add(text);
         return;
     }
 }
コード例 #26
0
 public static priority Createpriority(int priority_id)
 {
     priority priority = new priority();
     priority.priority_id = priority_id;
     return priority;
 }
コード例 #27
0
ファイル: db.designer.cs プロジェクト: EdiCarlos/MyPractices
 partial void Insertpriority(priority instance);
コード例 #28
0
 public void AddTopriorities(priority priority)
 {
     base.AddObject("priorities", priority);
 }
コード例 #29
0
ファイル: db.designer.cs プロジェクト: EdiCarlos/MyPractices
 partial void Deletepriority(priority instance);
コード例 #30
0
ファイル: Program.cs プロジェクト: VladasZ/Homework
 public Part(int price, string type, int buildSpeed, priority pr)
 {
     Done = false;
     Type = type;
     BuildProgress = 0;
     Priority = pr;
     BuildSpeed = buildSpeed;
     Price = price;
 }