当前位置: 首页>>代码示例>>C#>>正文


C# ScreenMessage类代码示例

本文整理汇总了C#中ScreenMessage的典型用法代码示例。如果您正苦于以下问题:C# ScreenMessage类的具体用法?C# ScreenMessage怎么用?C# ScreenMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScreenMessage类属于命名空间,在下文中一共展示了ScreenMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TransferData

		public IEnumerator TransferData(ScienceHardDrive drive) {
			if(drive.StartXfering()) {

				float secTotal = 0f;
				float secRemaining = 0f;
				ScreenMessage msg = null;
				ScienceData data = null;
				IScienceDataContainer container = null;
				KeyValuePair<ScienceData, IScienceDataContainer> kvp = new KeyValuePair<ScienceData, IScienceDataContainer>();

				while((kvp = QueueManager.instance.GetNextInXferQueue(drive)).Key != null) {
					data = kvp.Key;
					container = kvp.Value;

					if(data.dataAmount <= drive.capacity - drive.usedSpace) {
						secTotal = secRemaining = data.dataAmount / drive.xferRate;
						msg = new ScreenMessage("<color=#99ff00ff>Transfering " + data.title + " to " + drive.part.partInfo.title + ":  0%</color>", (float)secTotal + 5f, ScreenMessageStyle.UPPER_LEFT);

						ScreenMessages.PostScreenMessage(msg);
						while(secRemaining > 0 && Mathf.Round((float)drive.part.RequestResource("ElectricCharge", .1 * drive.powerUsage) * 10000) == .1 * drive.powerUsage * 10000) {
							yield return new WaitForSeconds(.1f);
							secRemaining -= .1f;
							msg.message = "<color=#99ff00ff>Transfering " + data.title + " to " + drive.part.partInfo.title + ": " + Mathf.Round(1000 * (secTotal - secRemaining) / secTotal) / 10 + "%</color>";
						}

						if(secRemaining > 0) {
							ScreenMessages.RemoveMessage(msg);
							ScreenMessages.PostScreenMessage("<color=#ff9900ff>Ran out of Electric Charge while transfering " + data.title + " to " + drive.part.partInfo.title + ".</color>", 5f, ScreenMessageStyle.UPPER_LEFT);
							QueueManager.instance.ClearXferQueue(drive);
						}
						else {
							ScreenMessages.RemoveMessage(msg);
							ScreenMessages.PostScreenMessage("<color=#99ff00ff>" + data.title + " transfered to " + drive.part.partInfo.title + ".</color>", 5f, ScreenMessageStyle.UPPER_LEFT);
							drive.AddData(data);
							container.DumpData(data);
						}
					}
					else {
						Print(drive.part.partInfo.title + " doesn't have the room for " + data.title);
					}

					QueueManager.instance.RemvoeFromXferQueue(drive, data);
				}

				yield return new WaitForSeconds(1f);
				drive.StopXfering();
			}
			else {
				Print(drive.part.partInfo.title + " is already transfering data.");
			}
		}
开发者ID:SirDargon,项目名称:ScienceHardDrives,代码行数:51,代码来源:QueueManager.cs

示例2: OnStart

		public override void OnStart(StartState state)
		{
			base.OnStart(state);

			if(HighLogic.LoadedSceneIsFlight)
			{
				focusIndexes = new List<int>();
				commandedPositions = new List<GPSTargetInfo>();
				part.force_activate();

				StartCoroutine(StartupRoutine());

				GameEvents.onGameStateSave.Add(SaveWingmen);
				GameEvents.onVesselLoaded.Add(OnVesselLoad);
				GameEvents.onVesselDestroy.Add(OnVesselLoad);
				GameEvents.onVesselGoOnRails.Add(OnVesselLoad);
				MissileFire.OnToggleTeam += OnToggleTeam;

				screenMessage = new ScreenMessage("", 2, ScreenMessageStyle.LOWER_CENTER);
			}
		}
开发者ID:BahamutoD,项目名称:BDArmory,代码行数:21,代码来源:ModuleWingCommander.cs

示例3: ShowModeMessage

 void ShowModeMessage()
 {
     if(moveMessage!=null)
     {
         ScreenMessages.RemoveMessage(moveMessage);
     }
     moveMessage = ScreenMessages.PostScreenMessage("Mode : "+moveMode.ToString(), 3, ScreenMessageStyle.UPPER_CENTER);
 }
开发者ID:BahamutoD,项目名称:VesselMover,代码行数:8,代码来源:VesselMove.cs

示例4: SendVesselUpdates

        private void SendVesselUpdates()
        {
            if (HighLogic.LoadedScene != GameScenes.FLIGHT)
            {
                //We aren't in flight so we have nothing to send
                return;
            }
            if (FlightGlobals.fetch.activeVessel == null)
            {
                //We don't have an active vessel
                return;
            }
            if (!FlightGlobals.fetch.activeVessel.loaded || FlightGlobals.fetch.activeVessel.packed)
            {
                //We haven't loaded into the game yet
                return;
            }

            if (ModWorker.fetch.modControl != ModControlMode.DISABLED)
            {
                if (!vesselPartsOk.ContainsKey(FlightGlobals.fetch.activeVessel.id.ToString()))
                {
                    //Check the vessel parts if we haven't already, shows the warning message in the safety bubble.
                    CheckVesselParts(FlightGlobals.fetch.activeVessel);
                }

                if (!vesselPartsOk[FlightGlobals.fetch.activeVessel.id.ToString()])
                {
                    if ((UnityEngine.Time.realtimeSinceStartup - lastBannedPartsMessageUpdate) > UPDATE_SCREEN_MESSAGE_INTERVAL)
                    {
                        lastBannedPartsMessageUpdate = UnityEngine.Time.realtimeSinceStartup;
                        if (bannedPartsMessage != null)
                        {
                            bannedPartsMessage.duration = 0;
                        }
                        if (ModWorker.fetch.modControl == ModControlMode.ENABLED_STOP_INVALID_PART_SYNC)
                        {
                            bannedPartsMessage = ScreenMessages.PostScreenMessage("Active vessel contains the following banned parts, it will not be saved to the server:\n" + bannedPartsString, 2f, ScreenMessageStyle.UPPER_CENTER);
                        }
                        if (ModWorker.fetch.modControl == ModControlMode.ENABLED_STOP_INVALID_PART_LAUNCH)
                        {
                            bannedPartsMessage = ScreenMessages.PostScreenMessage("Active vessel contains the following banned parts, you will be unable to launch on this server:\n" + bannedPartsString, 2f, ScreenMessageStyle.UPPER_CENTER);
                        }
                    }
                }
            }

            if (isSpectating)
            {
                //Don't send updates in spectate mode
                return;
            }
            if (fromDockedVesselID != null || toDockedVesselID != null)
            {
                //Don't send updates while docking
                return;
            }
            if (isSpectatorDocking)
            {
                //Definitely dont send updates while spectating a docking
                return;
            }

            if (isInSafetyBubble(FlightGlobals.fetch.activeVessel.GetWorldPos3D(), FlightGlobals.fetch.activeVessel.mainBody))
            {
                //Don't send updates while in the safety bubble
                return;
            }

            if (LockSystem.fetch.LockIsOurs("control-" + FlightGlobals.fetch.activeVessel.id.ToString()))
            {
                SendVesselUpdateIfNeeded(FlightGlobals.fetch.activeVessel);
            }
            SortedList<double, Vessel> secondryVessels = new SortedList<double, Vessel>();

            foreach (Vessel checkVessel in FlightGlobals.fetch.vessels)
            {
                //Only update the vessel if it's loaded and unpacked (not on rails). Skip our vessel.
                if (checkVessel.loaded && !checkVessel.packed && (checkVessel.id.ToString() != FlightGlobals.fetch.activeVessel.id.ToString()) && (checkVessel.state != Vessel.State.DEAD))
                {
                    //Don't update vessels in the safety bubble
                    if (!isInSafetyBubble(checkVessel.GetWorldPos3D(), checkVessel.mainBody))
                    {
                        //Only attempt to update vessels that we have locks for, and ask for locks. Dont bother with controlled vessels
                        bool updateLockIsFree = !LockSystem.fetch.LockExists("update-" + checkVessel.id.ToString());
                        bool updateLockIsOurs = LockSystem.fetch.LockIsOurs("update-" + checkVessel.id.ToString());
                        bool controlledByPlayer = LockSystem.fetch.LockExists("control-" + checkVessel.id.ToString());
                        if ((updateLockIsFree || updateLockIsOurs) && !controlledByPlayer)
                        {
                            //Dont update vessels manipulated in the future
                            if (!VesselUpdatedInFuture(checkVessel.id.ToString()))
                            {
                                double currentDistance = Vector3d.Distance(FlightGlobals.fetch.activeVessel.GetWorldPos3D(), checkVessel.GetWorldPos3D());
                                //If there's 2 vessels at the exact same distance.
                                if (!secondryVessels.ContainsKey(currentDistance) && !secondryVessels.ContainsValue(checkVessel))
                                {
                                    secondryVessels.Add(currentDistance, checkVessel);
                                }
                            }
                        }
//.........这里部分代码省略.........
开发者ID:kevin-ye,项目名称:DarkMultiPlayer,代码行数:101,代码来源:VesselWorker.cs

示例5: HandleSpectatorDocking

 private void HandleSpectatorDocking()
 {
     if (spectatorDockingID == null)
     {
         if ((UnityEngine.Time.realtimeSinceStartup - lastDockingMessageUpdate) > 1f)
         {
             lastDockingMessageUpdate = UnityEngine.Time.realtimeSinceStartup;
             if (dockingMessage != null)
             {
                 dockingMessage.duration = 0f;
             }
             dockingMessage = ScreenMessages.PostScreenMessage("Spectating docking in progress...", 3f, ScreenMessageStyle.UPPER_CENTER);
         }
     }
     else
     {
         Vessel switchToVessel = null;
         switchToVessel = FlightGlobals.fetch.vessels.FindLast(v => v.id.ToString() == spectatorDockingID);
         if (switchToVessel != null)
         {
             KillVessel(FlightGlobals.fetch.activeVessel);
             FlightGlobals.ForceSetActiveVessel(switchToVessel);
             isSpectatorDocking = false;
             spectatorDockingID = null;
             spectatorDockingPlayer = null;
         }
     }
 }
开发者ID:kevin-ye,项目名称:DarkMultiPlayer,代码行数:28,代码来源:VesselWorker.cs

示例6: RemoveScreenMsg

 internal static void RemoveScreenMsg()
 {
   var smessage = new ScreenMessage(string.Empty, 15f, ScreenMessageStyle.LOWER_CENTER);
   var smessages = FindObjectOfType<ScreenMessages>();
   if (smessages != null)
   {
     var smessagesToRemove = smessages.activeMessages.Where(x => x.startTime == smessage.startTime && x.style == ScreenMessageStyle.LOWER_CENTER).ToList();
     foreach (var m in smessagesToRemove)
       ScreenMessages.RemoveMessage(m);
   }
 }
开发者ID:Shavenbeard,项目名称:ShipManifest,代码行数:11,代码来源:SMAddon.cs

示例7: SkewTime


//.........这里部分代码省略.........
            //This brings the computers MET timer in to line with the server.
            if (isTimeSyncronized && skewServerTime != 0 && skewTargetTick != 0) {
                long timeFromLastSync = (DateTime.UtcNow.Ticks + offsetSyncTick) - skewServerTime;
                double timeFromLastSyncSeconds = (double)timeFromLastSync / 10000000;
                double timeFromLastSyncSecondsAdjusted = timeFromLastSyncSeconds * skewSubspaceSpeed;
                double currentError = Planetarium.GetUniversalTime () - (skewTargetTick + timeFromLastSyncSecondsAdjusted); //Ticks are integers of 100ns, Planetarium camera is a float in seconds.
                double currentErrorMs = Math.Round (currentError * 1000, 2);

                if (Math.Abs (currentError) > 5) {
                    if (skewMessage != null) {
                        skewMessage.duration = 0f;
                    }
                    if (isInFlight && FlightGlobals.ActiveVessel != null) {
                        krakensBaneWarp(skewTargetTick + timeFromLastSyncSecondsAdjusted);
                    } else {
                        Planetarium.SetUniversalTime(skewTargetTick + timeFromLastSyncSecondsAdjusted);
                    }
                    return;
                }

                //Dynamic warp.
                float timeWarpRate = (float) Math.Pow(2, -currentError);
                if ( timeWarpRate > 1.5f ) timeWarpRate = 1.5f;
                if ( timeWarpRate < 0.5f ) timeWarpRate = 0.5f;

                if (Math.Abs(currentError) > 0.2) {
                    isSkewingTime = true;
                    Time.timeScale = timeWarpRate;
                }

                if (Math.Abs(currentError) < 0.05 && isSkewingTime) {
                    isSkewingTime = false;
                    Time.timeScale = 1;
                }

                //Let's give the client a little bit of time to settle before being able to request a different rate.
                if (UnityEngine.Time.realtimeSinceStartup > lastSubspaceLockChange + 10f) {
                    float requestedRate = (1 / timeWarpRate) * skewSubspaceSpeed;
                    listClientTimeWarp.Add(requestedRate);
                    listClientTimeWarpAverage = listClientTimeWarp.Average();
                } else {
                    listClientTimeWarp.Add(skewSubspaceSpeed);
                    listClientTimeWarpAverage = listClientTimeWarp.Average();
                }

                //Keeps the last 10 seconds (300 update steps) of clock speed history to report to the server
                if (listClientTimeWarp.Count > 300) {
                    listClientTimeWarp.RemoveAt(0);
                }

                if (displayNTP) {
                    if (skewMessage != null) {
                        //Hide the old message.
                        skewMessage.duration = 0;
                    }
                    //Current clock error in milliseconds
                    String skewMessageText;
                    skewMessageText = "\n\nClock error: " + currentErrorMs + "ms.\n";
                    skewMessageText += "Game speed: " + Math.Round(Time.timeScale, 3) + "x.\n";
                    //Current client latency detected by NTP (latency - server processing time)
                    long latencySyncTickMs = latencySyncTick / 10000;
                    skewMessageText += "Network latency: " + latencySyncTickMs + "ms.\n";
                    //Current system clock offset
                    skewMessageText += "Clock offset: ";
                    long tempOffsetSyncTick = offsetSyncTick;
                    long offsetSyncTickHours = tempOffsetSyncTick / 36000000000;
                    tempOffsetSyncTick -= offsetSyncTickHours * 36000000000;
                    if (offsetSyncTickHours > 0) {
                        skewMessageText += offsetSyncTickHours + "h, ";
                    }
                    long offsetSyncTickMinutes = tempOffsetSyncTick / 600000000;
                    tempOffsetSyncTick -= offsetSyncTickMinutes * 600000000;
                    if (offsetSyncTickMinutes > 0) {
                        skewMessageText += offsetSyncTickMinutes + "m, ";
                    }
                    long offsetSyncTickSeconds = tempOffsetSyncTick / 10000000;
                    tempOffsetSyncTick -= offsetSyncTickSeconds * 10000000;
                    if (offsetSyncTickSeconds > 0) {
                        skewMessageText += offsetSyncTickSeconds + "s, ";
                    }
                    long offsetSyncTickMilliseconds = tempOffsetSyncTick / 10000;
                    skewMessageText += offsetSyncTickMilliseconds + "ms.\n";
                    //Current subspace speed
                    skewMessageText += "Subspace Speed: " + Math.Round(skewSubspaceSpeed, 3) + "x.\n";
                    //Estimated server lag
                    skewMessageText += "Server lag: ";
                    long tempServerLag = estimatedServerLag;
                    long serverLagSeconds = tempServerLag / 10000000;
                    tempServerLag -= serverLagSeconds * 10000000;
                    if (serverLagSeconds > 0) {
                        skewMessageText += serverLagSeconds + "s, ";
                    }
                    long serverLagMilliseconds = tempServerLag / 10000;
                    skewMessageText += serverLagMilliseconds + "ms.\n";
                    skewMessageText += "Universe Time: " + Planetarium.GetUniversalTime() + "\n";

                    skewMessage = ScreenMessages.PostScreenMessage(skewMessageText, 1f, ScreenMessageStyle.UPPER_RIGHT);
                }
            }
        }
开发者ID:vosechu,项目名称:KerbalMultiPlayer,代码行数:101,代码来源:KMPManager.cs

示例8: UpdateBoneRig

        private void UpdateBoneRig(KerbalActor actor)
        {
            if (!_isAvateeringEnabled)
            {
                return;
                //actor.Part.animation.Stop();
            }

            elbowAngle += elbowDelta;
            if (elbowAngle >= 90 && elbowDelta >= 0)
            {
                elbowDelta = -1;
                elbowAngle = 90;
            }
            else if (elbowAngle <= 0)
            {
                elbowAngle = 0;
                elbowDelta = 1;
            }
            //actor.ElbowRightTransform.localRotation = Quaternion.Euler(0, elbowAngle, 0);
            //actor.ShoulderRightTransform.localRotation = Quaternion.Euler(0, elbowAngle, 0);
            //actor.ElbowLeftTransform.localRotation = Quaternion.Euler(0, 90-elbowAngle, 0);
            //actor.ShoulderLeftTransform.localRotation = Quaternion.Euler(0, 90 - elbowAngle, 0);

            actor.ElbowRightTransform.localRotation = Quaternion.identity;
            actor.ShoulderRightTransform.localRotation = Quaternion.identity;
            actor.ElbowLeftTransform.localRotation = Quaternion.identity;
            actor.ShoulderLeftTransform.localRotation = Quaternion.identity;

            return;

            if (actor.ElbowRightTransform == null || !_isAvateeringEnabled)
            {
                RemoveNoBodyMessage();
                return;
            }
            var body = _bodySourceManager.PrimaryBody;
            if (body == null)
            {
                if (_noBodyMessage == null)
                {
                    _noBodyMessage = ScreenMessages.PostScreenMessage("Body not found", 1f, ScreenMessageStyle.UPPER_CENTER);
                }
                return;
            }

            RemoveNoBodyMessage();

            ScreenMessages.PostScreenMessage("Tracking body!", 2f, ScreenMessageStyle.UPPER_CENTER);

            var rootBone = _mapper.GetBoneOrientations(body);

            //var elbowBone = rootBone.FindBoneWithChild(Windows.Kinect.JointType.WristRight);

            //if (elbowBone != null)
            //{
            //    actor.ElbowTransform.localRotation = elbowBone.Rotation;
            //}

            var shoulderRight = body.Joints[JointType.ShoulderRight].Position;
            var shoulderCenter = body.Joints[JointType.SpineShoulder].Position;
            var delta = new Vector3(shoulderRight.X - shoulderCenter.X,
                                    shoulderRight.Y - shoulderCenter.Y,
                                    shoulderRight.Z - shoulderCenter.Z);

            //Util.Log("Shoulder quaternion: {0}, {1}, {2}, {3}, Delta vec: {4}, {5}, {6}", q.x, q.y, q.z, q.w, delta.x, delta.y, delta.z);

            UpdateTransformRotation(actor.ShoulderRightTransform, rootBone.FindBoneWithChild(JointType.ElbowRight).Rotation);
            //UpdateTransformRotation(actor.ElbowRightTransform, Quaternion.identity);
            //UpdateTransformRotation(actor.ElbowRightTransform, rootBone.FindBoneWithChild(JointType.WristRight));

            //UpdateTransformRotation(actor.ShoulderLeftTransform, rootBone.FindBoneWithChild(JointType.ElbowLeft).Rotation);

            actor.ShoulderLeftTransform.localRotation = rootBone.FindBoneWithChild(JointType.ElbowLeft).Rotation;
            //UpdateTransformRotation(actor.ElbowLeftTransform, Quaternion.identity);
            //UpdateTransformRotation(actor.ElbowLeftTransform, rootBone.FindBoneWithChild(JointType.WristLeft));
        }
开发者ID:JoshBlake,项目名称:KerbExpressions,代码行数:77,代码来源:ExpressionController.cs

示例9: StartTransfer

 // starts and stops transfer mode
 private void StartTransfer()
 {
     transferring = true;
     transferMessage = new ScreenMessage("Left click a part to transfer nuclear fuel", 999f, ScreenMessageStyle.UPPER_CENTER);
     ScreenMessages.PostScreenMessage(transferMessage);
 }
开发者ID:billkerbinsky,项目名称:NearFutureElectrical,代码行数:7,代码来源:RadioactiveStorageContainer.cs

示例10: Start

        public override void Start()
        {
            base.Start();
            if (ullageSet == null)
                ullageSet = new Ullage.UllageSet(this);

            Fields["ignitions"].guiActive = Fields["ignitions"].guiActiveEditor = (ignitions >= 0 && RFSettings.Instance.limitedIgnitions);
            Fields["propellantStatus"].guiActive = Fields["propellantStatus"].guiActiveEditor = (pressureFed || (ullage && RFSettings.Instance.simulateUllage));

            igniteFailIgnitions = new ScreenMessage("<color=orange>[" + part.partInfo.title + "]: no ignitions remaining!</color>", 5f, ScreenMessageStyle.UPPER_CENTER);
            igniteFailResources = new ScreenMessage("<color=orange>[" + part.partInfo.title + "]: insufficient resources to ignite!</color>", 5f, ScreenMessageStyle.UPPER_CENTER);
            ullageFail = new ScreenMessage("<color=orange>[" + part.partInfo.title + "]: vapor in feedlines, shut down!</color>", 5f, ScreenMessageStyle.UPPER_CENTER);
        }
开发者ID:qipa,项目名称:ModularFuelSystem,代码行数:13,代码来源:ModuleEnginesRF.cs

示例11: screenMessage

 public static void screenMessage(string msg)
 {
     ScreenMessage smg = new ScreenMessage(msg, 4.0f, ScreenMessageStyle.UPPER_CENTER);
     ScreenMessages.PostScreenMessage(smg);
 }
开发者ID:Profit0004,项目名称:CivilianPopulation,代码行数:5,代码来源:CivilianManagment.cs

示例12: Update

        public void Update()
        {
            try
            {
                if (HighLogic.LoadedScene == GameScenes.MAINMENU && !ModWorker.fetch.dllListBuilt)
                {
                    ModWorker.fetch.dllListBuilt = true;
                    ModWorker.fetch.BuildDllFileList();
                }
                if (displayDisconnectMessage)
                {
                    if (HighLogic.LoadedScene == GameScenes.MAINMENU)
                    {
                        displayDisconnectMessage = false;
                    }
                    else
                    {
                        if ((UnityEngine.Time.realtimeSinceStartup - lastDisconnectMessageCheck) > 1f)
                        {
                            lastDisconnectMessageCheck = UnityEngine.Time.realtimeSinceStartup;
                            if (disconnectMessage != null)
                            {
                                disconnectMessage.duration = 0;
                            }
                            disconnectMessage = ScreenMessages.PostScreenMessage("You have been disconnected!", 2f, ScreenMessageStyle.UPPER_CENTER);
                        }
                    }
                }
                //Handle GUI events
                if (!PlayerStatusWindow.fetch.disconnectEventHandled)
                {
                    PlayerStatusWindow.fetch.disconnectEventHandled = true;
                    forceQuit = true;
                    NetworkWorker.fetch.SendDisconnect("Quit");
                }
                if (!ConnectionWindow.fetch.renameEventHandled)
                {
                    PlayerStatusWorker.fetch.myPlayerStatus.playerName = Settings.fetch.playerName;
                    Settings.fetch.SaveSettings();
                    ConnectionWindow.fetch.renameEventHandled = true;
                }
                if (!ConnectionWindow.fetch.addEventHandled)
                {
                    Settings.fetch.servers.Add(ConnectionWindow.fetch.addEntry);
                    ConnectionWindow.fetch.addEntry = null;
                    Settings.fetch.SaveSettings();
                    ConnectionWindow.fetch.addingServer = false;
                    ConnectionWindow.fetch.addEventHandled = true;
                }
                if (!ConnectionWindow.fetch.editEventHandled)
                {
                    Settings.fetch.servers[ConnectionWindow.fetch.selected].name = ConnectionWindow.fetch.editEntry.name;
                    Settings.fetch.servers[ConnectionWindow.fetch.selected].address = ConnectionWindow.fetch.editEntry.address;
                    Settings.fetch.servers[ConnectionWindow.fetch.selected].port = ConnectionWindow.fetch.editEntry.port;
                    ConnectionWindow.fetch.editEntry = null;
                    Settings.fetch.SaveSettings();
                    ConnectionWindow.fetch.addingServer = false;
                    ConnectionWindow.fetch.editEventHandled = true;
                }
                if (!ConnectionWindow.fetch.removeEventHandled)
                {
                    Settings.fetch.servers.RemoveAt(ConnectionWindow.fetch.selected);
                    ConnectionWindow.fetch.selected = -1;
                    Settings.fetch.SaveSettings();
                    ConnectionWindow.fetch.removeEventHandled = true;
                }
                if (!ConnectionWindow.fetch.connectEventHandled)
                {
                    NetworkWorker.fetch.ConnectToServer(Settings.fetch.servers[ConnectionWindow.fetch.selected].address, Settings.fetch.servers[ConnectionWindow.fetch.selected].port);
                    ConnectionWindow.fetch.connectEventHandled = true;
                }

                if (!ConnectionWindow.fetch.disconnectEventHandled)
                {
                    ConnectionWindow.fetch.disconnectEventHandled = true;
                    gameRunning = false;
                    FireResetEvent();
                    NetworkWorker.fetch.SendDisconnect("Quit during initial sync");
                }
                foreach (Action updateAction in updateEvent)
                {
                    try
                    {
                        updateAction();
                    }
                    catch (Exception e)
                    {
                        DarkLog.Debug("Threw in UpdateEvent, exception: " + e);
                    }
                }
                //Force quit
                if (forceQuit)
                {
                    forceQuit = false;
                    gameRunning = false;
                    FireResetEvent();
                    NetworkWorker.fetch.SendDisconnect("Force quit to main menu");
                    StopGame();
                }

//.........这里部分代码省略.........
开发者ID:Norgg,项目名称:DarkMultiPlayer,代码行数:101,代码来源:Main.cs

示例13: AddVesselToBuildList

 public static KCT_BuildListVessel AddVesselToBuildList(KCT_BuildListVessel blv, Dictionary<String, int> inventory)
 {
     if (CurrentGameIsCareer())
     {
         float totalCost = blv.cost;
         double prevFunds = Funding.Instance.Funds;
         double newFunds = SpendFunds(totalCost);
         if (prevFunds == newFunds)
         {
             Debug.Log("[KCT] Tried to add " + blv.shipName + " to build list but not enough funds.");
             Debug.Log("[KCT] Vessel cost: " + blv.cost + ", Current funds: " + newFunds);
             var msg = new ScreenMessage("Not Enough Funds To Build!", 4.0f, ScreenMessageStyle.UPPER_CENTER);
             ScreenMessages.PostScreenMessage(msg, true);
             return blv;
         }
     }
     string type = "";
     if (blv.type == KCT_BuildListVessel.ListType.VAB)
     {
         KCT_GameStates.VABList.Add(blv);
         type = "VAB";
     }
     else if (blv.type == KCT_BuildListVessel.ListType.SPH)
     {
         KCT_GameStates.SPHList.Add(blv);
         type = "SPH";
     }
     if (inventory.Count > 0)
     {
         foreach (string p in blv.GetPartNames())
         {
             if (KCT_Utilities.RemovePartFromInventory(p, inventory))
                 blv.InventoryParts.Add(p);
         }
     }
     Debug.Log("[KCT] Added " + blv.shipName + " to " + type + " build list. Cost: "+blv.cost);
     //Debug.Log("[KCT] Cost Breakdown (total, parts, fuel): " + blv.totalCost + ", " + blv.dryCost + ", " + blv.fuelCost);
     var message = new ScreenMessage("[KCT] Added " + blv.shipName + " to " + type + " build list.", 4.0f, ScreenMessageStyle.UPPER_CENTER);
     ScreenMessages.PostScreenMessage(message, true);
     return blv;
 }
开发者ID:ntwest,项目名称:KCT,代码行数:41,代码来源:KCT_Utilities.cs

示例14: AddScienceWithMessage

 public static void AddScienceWithMessage(float science)
 {
     if (science > 0)
     {
         ResearchAndDevelopment.Instance.Science += science;
         var message = new ScreenMessage("[KCT] " + science + " science added.", 4.0f, ScreenMessageStyle.UPPER_LEFT);
         ScreenMessages.PostScreenMessage(message, true);
     }
 }
开发者ID:ntwest,项目名称:KCT,代码行数:9,代码来源:KCT_Utilities.cs

示例15: PopCommand

        private void PopCommand()
        {
            // Maneuvers
            while (mManeuverQueue.Count > 0 && mManeuverQueue.First.Value.TimeStamp <= RTUtil.GameTime)
            {
                DelayedManeuver = mManeuverQueue.First.Value.Node;
                mManeuverQueue.RemoveFirst();
            }

            // Commands
            if (SignalProcessor.Powered && mCommandQueue.Count > 0)
            {
                if (RTSettings.Instance.ThrottleTimeWarp && TimeWarp.CurrentRate > 1.0f)
                {
                    var time = TimeWarp.deltaTime;
                    foreach (var dc in mCommandQueue.TakeWhile(c => c.TimeStamp <= RTUtil.GameTime + (2 * time + 1.0)))
                    {
                        var message = new ScreenMessage("[Flight Computer]: Throttling back time warp...", 4.0f, ScreenMessageStyle.UPPER_LEFT);
                        while ((2 * TimeWarp.deltaTime + 1.0) > (Math.Max(dc.TimeStamp - RTUtil.GameTime, 0) + dc.ExtraDelay) && TimeWarp.CurrentRate > 1.0f)
                        {
                            TimeWarp.SetRate(TimeWarp.CurrentRateIndex - 1, true);
                            ScreenMessages.PostScreenMessage(message, true);
                        }
                    }
                }

                foreach (var dc in mCommandQueue.TakeWhile(c => c.TimeStamp <= RTUtil.GameTime).ToList())
                {
                    if (dc.ExtraDelay > 0)
                    {
                        dc.ExtraDelay -= SignalProcessor.Powered ? TimeWarp.deltaTime : 0.0;
                    }
                    else
                    {
                        if (dc.Pop(this)) mActiveCommands[dc.Priority] = dc;
                        mCommandQueue.Remove(dc);
                    }
                }
            }
        }
开发者ID:techtektek,项目名称:RemoteTech,代码行数:40,代码来源:FlightComputer.cs


注:本文中的ScreenMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。