コード例 #1
0
ファイル: GridEnforcer.cs プロジェクト: Devlah/GardenConquest
 private void detatchCleanupTimer()
 {
     if (m_CleanupTimer != null) {
         cancelCleanupTimer(false);
         m_CleanupTimer = null;
     }
 }
コード例 #2
0
ファイル: Core_Server.cs プロジェクト: Devlah/GardenConquest
        public void eventCleanupTimerEnd(GridEnforcer ge, DerelictTimer.COMPLETION c)
        {
            //log("start", "eventCleanupTimerEnd", Logger.severity.TRACE);
            if (ge == null)
                return;

            //log("grid exists, getting owner", "eventCleanupTimerEnd", Logger.severity.TRACE);
            GridOwner owner = ge.Owner;
            //log("grid exists, getting owner type", "eventCleanupTimerEnd", Logger.severity.TRACE);
            GridOwner.OWNER_TYPE owner_type = owner.OwnerType;
            //log("grid exists, getting faction", "eventCleanupTimerEnd", Logger.severity.TRACE);
            long gridFactionID = ge.Owner.FactionID;

            //log("determining destinations", "eventCleanupTimerEnd", Logger.severity.TRACE);
            BaseResponse.DEST_TYPE destType = BaseResponse.DEST_TYPE.NONE;
            List<long> Destinations = new List<long>();
            string message = "";

            if (owner_type == GridOwner.OWNER_TYPE.FACTION) {
                destType = BaseResponse.DEST_TYPE.FACTION;
                Destinations.Add(gridFactionID);
                message += "Your faction's ";
            }
            else if (owner_type == GridOwner.OWNER_TYPE.PLAYER) {
                destType = BaseResponse.DEST_TYPE.PLAYER;
                Destinations.Add(ge.Owner.PlayerID);
                message += "Your ";
            }
            else {
                List<long> nearbyPlayers = ge.Grid.getPlayerIDsWithinPlacementRadius();
                if (nearbyPlayers.Count > 0) {
                    destType = BaseResponse.DEST_TYPE.PLAYER;
                    Destinations = nearbyPlayers;
                    message += "Nearby ";
                }
                else {
                    return;
                }
            }

            log("building message", "eventCleanupTimerEnd", Logger.severity.TRACE);
            MyFontEnum font = MyFontEnum.Red;
            if (c == DerelictTimer.COMPLETION.CANCELLED) {
                message += "grid " + ge.Grid.DisplayName + " is now within limits.";
                font = MyFontEnum.Green;
            } else if (c == DerelictTimer.COMPLETION.ELAPSED) {
                message += "grid " + ge.Grid.DisplayName +
                    " had some of its offending blocks removed.";
                font = MyFontEnum.Red;
            }

            log("Sending message", "eventDerelictEnd");
            NotificationResponse noti = new NotificationResponse() {
                NotificationText = message,
                Time = Constants.NotificationMillis,
                Font = font,
                Destination = Destinations,
                DestType = destType
            };
            m_MailMan.send(noti);
        }
コード例 #3
0
ファイル: GridEnforcer.cs プロジェクト: Devlah/GardenConquest
        /// <summary>
        /// If the rules are met before the timer expires this cancels the timer
        /// </summary>
        private void cancelCleanupTimer(bool notify = true)
        {
            log("start", "cancelCleanupTimer", Logger.severity.TRACE);
            if (m_CleanupTimer != null) {
                log("not null, cancelling", "cancelCleanupTimer", Logger.severity.TRACE);
                if (m_CleanupTimer.cancel()) {
                    log("successuflly cancelled", "cancelCleanupTimer", Logger.severity.TRACE);

                    if (notify) {
                        notifyCleanupTimerEnd(DerelictTimer.COMPLETION.CANCELLED);
                        log("notify complete", "cancelCleanupTimer", Logger.severity.TRACE);
                    }

                }
                m_CleanupTimer = null;

            }
            log("done", "cancelCleanupTimer", Logger.severity.TRACE);
        }
コード例 #4
0
ファイル: GridEnforcer.cs プロジェクト: Devlah/GardenConquest
        /// <summary>
        /// Starts the timer and alerts the player
        /// </summary>
        private void startCleanupTimer(bool notify = true)
        {
            //log("", "startCleanupTimer");
            // Don't start a second timer
            if (m_CleanupTimer != null) {
                log("already running", "startCleanupTimer");
                return;
            }

            m_CleanupTimer = new DerelictTimer(m_Grid);
            log("new timer", "startCleanupTimer");
            if (m_CleanupTimer.start() && notify) {
                log("notifying", "startCleanupTimer");
                notifyCleanupTimerStart(m_CleanupTimer.SecondsRemaining);
            }
        }
コード例 #5
0
ファイル: GridEnforcer.cs プロジェクト: Devlah/GardenConquest
 private void notifyCleanupTimerEnd(DerelictTimer.COMPLETION completionState)
 {
     if (eventOnCleanupTimerEnd != null)
         eventOnCleanupTimerEnd(this, completionState);
 }
コード例 #6
0
ファイル: GridEnforcer.cs プロジェクト: Devlah/GardenConquest
 private void elapseCleanupTimer()
 {
     m_CleanupTimer = null;
     log("cleanup timer set to null", "doCleanupPhase");
     log("notifyCleanupTimerEnd", "doCleanupPhase");
     notifyCleanupTimerEnd(DerelictTimer.COMPLETION.ELAPSED);
 }
コード例 #7
0
ファイル: StateTracker.cs プロジェクト: MrZSFG/GardenConquest
 /// <summary>
 /// Adds a new derelict timer to the queue.
 /// This will be used to alert the faction
 /// </summary>
 /// <param name="dt"></param>
 public void addNewDerelictTimer(DerelictTimer.DT_INFO dt)
 {
     m_SavedState.DerelictTimers.Add(dt);
 }