Example #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);
                }
            }
Example #2
0
 public ActionsToDo(action targetAction, int targetObjectTypeID, priority targetPriority, parameters targetParameters)
 {
     _action       = targetAction;
     _priority     = targetPriority;
     _objectTypeID = targetObjectTypeID;
     _parameters   = targetParameters;
 }
        public ActionResult DeleteConfirmed(byte id)
        {
            priority priority = db.priorities.Find(id);

            db.priorities.Remove(priority);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 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));
 }
Example #5
0
 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;
 }
Example #6
0
    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);
    }
Example #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);
                }
            }
Example #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);
                }
            }
        public ActionResult Create([Bind(Include = "id,priorityname")] priority priority)
        {
            if (ModelState.IsValid)
            {
                db.priorities.Add(priority);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(priority));
        }
Example #10
0
 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;
 }
        // 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));
        }
Example #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);
                }
            }
Example #13
0
    /// 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;
            })
                                             );
        }
    }
Example #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);
     }
 }
Example #15
0
 partial void Updatepriority(priority instance);
 public ServiceContracts(uint fileNumber, priority priority)
 {
     this.fileNumber = fileNumber;
     this.priority = priority;
 }
Example #17
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);
     }
 }
Example #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);
     }
 }
Example #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);
     }
 }
Example #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);
     }
 }
Example #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);
     }
 }
Example #22
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);
     }
 }
Example #23
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, 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);
     }
 }
Example #24
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)
 {
     Message text = new Message();
     text._Priority = Pr;
     text.message = Message;
     text.channel = Channel.Name;
     lock (messages)
     {
         messages.Add(text);
         return;
     }
 }
Example #25
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();
     text._Priority = Pr;
     text.message = Message;
     text.channel = User.Nick;
     lock (messages)
     {
         messages.Add(text);
         return;
     }
 }
Example #26
0
 public static priority Createpriority(int priority_id)
 {
     priority priority = new priority();
     priority.priority_id = priority_id;
     return priority;
 }
Example #27
0
 partial void Insertpriority(priority instance);
Example #28
0
 public void AddTopriorities(priority priority)
 {
     base.AddObject("priorities", priority);
 }
Example #29
0
 partial void Deletepriority(priority instance);
Example #30
0
 public Part(int price, string type, int buildSpeed, priority pr)
 {
     Done = false;
     Type = type;
     BuildProgress = 0;
     Priority = pr;
     BuildSpeed = buildSpeed;
     Price = price;
 }