Inheritance: MonoBehaviour
コード例 #1
0
    void FixtureCreateHealth() {
      Configuration.ClearInstance();
      UpdateManager.ClearInstance();
      System.GC.Collect();

      var obj = new GameObject();
      config = obj.AddComponent<Configuration>();
      Assert.NotNull(config);
      umgr = obj.AddComponent<UpdateManager>();
      Assert.NotNull(umgr);


      var objx = new GameObject();
      character = objx.AddComponent<Character>();
      Assert.NotNull(character);
      health = objx.GetComponent<CharacterHealth>();
      Assert.NotNull(health);
      col2d = objx.GetComponent<PlatformerCollider2D>();
      Assert.NotNull(col2d);

      health.onHeal += () => { onHealCalled = true; };
      health.onDamage += () => { onDamageCalled = true; };
      health.onImmunity += () => { onImmunityCalled = true; };
      health.onMaxHealth += () => { onMaxHealthCalled = true; };
      health.onInjured += (Damage dt, CharacterHealth to) => { onInjuredCalled = true; };
      health.onHurt += (Damage dt, CharacterHealth to) => { onHurtCalled = true; };
      health.onDeath += () => { onDeathCalled = true; };
      health.onGameOver += () => { onGameOverCalled = true; };
      health.onInvulnerabilityStart += () => { onInvulnerabilityStartCalled = true; };
      health.onInvulnerabilityEnd += () => { onInvulnerabilityEndCalled = true; };
      health.onRespawn += () => { onRespawnCalled = true; };

      ResetCallbacks();
    }
コード例 #2
0
		private bool worldMatrixDirty = true; // set to true if worldMatrix is no longer valid, see 'UpdateWorldMatrix()'

		//create the actor
		public Actor(ContentRegister content, UpdateManager updateManager, MaterialLightCollection lights, float groundRadius)
		{
			this.groundRadius = groundRadius;

			model = new ModelInstance();
			model.LightCollection = lights;

			//force the model to render using spherical harmonic lighting
			//this will significantly improve performance on some hardware when GPU limited
			model.ShaderProvider = new Xen.Ex.Graphics.Provider.LightingDisplayShaderProvider(LightingDisplayModel.ForceSphericalHarmonic, model.ShaderProvider);

			//random starting position
			position = GetRandomPosition();

			//initially target the current position
			//the 'move to next target' timer will wind down and then the actor will move
			target = position;

			//randomize a bit
			lookAngle = (float)random.NextDouble() * MathHelper.TwoPi;
			moveSpeed = (float)random.NextDouble() * 0.9f + 0.1f;

			content.Add(this);
			updateManager.Add(this);


			InitaliseAnimations(updateManager);
		}
コード例 #3
0
 public UpdateProgressViewModel(UpdateManager updateManger,IProductUpdate productUpdate)
 {
     _updateManger = updateManger;
     _productUpdate = productUpdate;
     _dispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, Dispatcher.CurrentDispatcher);
     StartUpdateProgressTimer();
 }
コード例 #4
0
		/// <summary>Construct the logo</summary>
		public XenLogo(UpdateManager updateManager)
		{
			if (updateManager == null)
				throw new ArgumentNullException();

			content = new ContentLoader(Application.GetApplicationInstance().Services);

			this.clearBackground = true;
			
			//setup the system and drawer
			this.particles = new Xen.Ex.Graphics.ParticleSystem(updateManager);
			this.particleDrawer = new VelocityBillboardParticles2DElement(this.particles, false, 0.025f);

			//align it...
			this.particleDrawer.VerticalAlignment = Xen.Ex.Graphics2D.VerticalAlignment.Centre;
			this.particleDrawer.HorizontalAlignment = Xen.Ex.Graphics2D.HorizontalAlignment.Centre;

			//clear background is optional.
			this.clear = new Xen.Graphics.Modifier.ClearBufferModifier(Microsoft.Xna.Framework.Graphics.ClearOptions.Target);
			this.clear.ClearColour = new Microsoft.Xna.Framework.Color();

			//load the data straight from the assembly.
			this.particles.ParticleSystemData = content.Load<Xen.Ex.Graphics.Content.ParticleSystemData>("Logo");
			this.particleTrigger = this.particles.GetTriggerByName("Fire");

			updateManager.Add(this);
		}
コード例 #5
0
		/// <summary>
		/// Construct the particle system. Before the particle system is used, the <see cref="ParticleSystemData"/> must be set
		/// </summary>
		/// <param name="update"></param>
		public ParticleSystem(UpdateManager update)
			: this()
		{
			if (update == null)
				throw new ArgumentNullException();

			update.Add(this);
		}
コード例 #6
0
        public static async Task Update()
        {
            if (!CanUpdate()) return;

            using (var mgr = new UpdateManager(UpdatePath, AppName))
            {
                await mgr.UpdateApp();
            }
        }
コード例 #7
0
		//The class is constructed with a camera and a reference to the Applications
		//UpdateManager
		public CameraOrbit(Camera3D camera, UpdateManager manager)
		{
			//keep a reference to the camera
			this.camera = camera;


			//Add this object to the update manager
			manager.Add(this);
		}
コード例 #8
0
        public void FindPrereleasePackage()
        {
            var rep = GetLocalRepository();

            var sut = new UpdateManager(APP_NAME, new Version(1, 1), rep);
            sut.CheckForUpdate(includePrereleases: true);

            Assert.AreEqual(1, sut.AvailableUpdates.Count());
        }
コード例 #9
0
        public void NoNewerReleasePackages()
        {
            var rep = GetLocalRepository();

            var sut = new UpdateManager(APP_NAME, new Version(1, 1), rep);
            sut.CheckForUpdate();

            Assert.AreEqual(0, sut.AvailableUpdates.Count());
        }
コード例 #10
0
        public void WithNoCurrentVersionGetAllPackages()
        {
            var rep = GetLocalRepository();

            var sut = new UpdateManager(APP_NAME, null, rep);
            sut.CheckForUpdate();

            Assert.AreEqual(2, sut.AvailableUpdates.Count());
        }
コード例 #11
0
	/// <summary>
	/// Ensure that there is an instance of this class somewhere in the scene.
	/// </summary>
	
	static void CreateInstance()
	{
		if (mInstance == null)
		{
			GameObject go = new GameObject("_UpdateManager");
			mInstance = go.AddComponent<UpdateManager>();
			DontDestroyOnLoad(go);
		}
	}
コード例 #12
0
		/// <summary>
		/// Construct a particle system with data
		/// </summary>
		/// <param name="systemData"></param>
		/// <param name="update"></param>
		public ParticleSystem(ParticleSystemData systemData, UpdateManager update)
			: this()
		{
			if (update == null)
				throw new ArgumentNullException();

			Initalise(systemData, DefaultProcessorType);

			update.Add(this);
		}
コード例 #13
0
        public static async Task<ReleaseEntry> CheckForUpdate()
        {
            if (!CanUpdate()) return null;

            using (var mgr = new UpdateManager(UpdatePath, AppName))
            {
                var updateInfo = await mgr.CheckForUpdate();
                return updateInfo.FutureReleaseEntry;
            }
        }
コード例 #14
0
ファイル: UpdateManager.cs プロジェクト: HexHash/LegacyRust
 private static int Compare(UpdateManager.UpdateEntry a, UpdateManager.UpdateEntry b)
 {
     if (a.index < b.index)
     {
         return 1;
     }
     if (a.index > b.index)
     {
         return 1;
     }
     return 0;
 }
コード例 #15
0
		public ShimmerInstaller(ShimmerConfiguration configuration)
		{
			var urlOrPath = configuration.UrlOrPath;
			var applicationName = configuration.ApplicationName;
			var frameworkVersion = configuration.FrameworkVersion;

			updateManager = new UpdateManager(urlOrPath, applicationName, frameworkVersion);
			updateInfo = updateManager.CheckForUpdate().Wait();

			UpdatesAvailable = updateInfo.ReleasesToApply.Any();
			InstallationPath = updateManager.LatestInstallationPath(updateInfo);
		}
コード例 #16
0
    void Fixture() {
      Configuration.ClearInstance();
      UpdateManager.ClearInstance();
      System.GC.Collect();

      var obj = new GameObject();
      config = obj.AddComponent<Configuration>();
      Assert.NotNull(config);
      umgr = obj.AddComponent<UpdateManager>();
      Assert.NotNull(umgr);

      ResetCallbacks();
    }
コード例 #17
0
        public UpdatePropopsalViewModel(IViewModelInteraction viewModelInteraction ,UpdateManager updateManager, IProductUpdate productUpdate)
        {
            if (productUpdate == null)
                throw new ProductUpdateFailedException(new NullReferenceException("ProductUpdate!"));

            _viewModelInteraction = viewModelInteraction;
            _productUpdate = productUpdate;
            _updateManager = updateManager;
            _userInterfaceFactory = new UpdateUserInterfaceFactory(_updateManager);


            ShowUpdateInfo();
            
        }
コード例 #18
0
    void Fixture() {
      Configuration.ClearInstance();
      UpdateManager.ClearInstance();
      System.GC.Collect();

      var obj = new GameObject();
      config = obj.AddComponent<Configuration>();
      Assert.NotNull(config);
      umgr = obj.AddComponent<UpdateManager>();
      Assert.NotNull(umgr);

      char1 = new TestCharacter("char1");
      char2 = new TestCharacter("char2");
    }
コード例 #19
0
ファイル: UpdateManager.cs プロジェクト: Burnknee/IpadApp
	/// <summary>
	/// Ensure that there is an instance of this class present.
	/// </summary>

	static void CreateInstance ()
	{
		if (mInst == null)
		{
			mInst = GameObject.FindObjectOfType(typeof(UpdateManager)) as UpdateManager;

			if (mInst == null && Application.isPlaying)
			{
				GameObject go = new GameObject("_UpdateManager");
				DontDestroyOnLoad(go);
				//go.hideFlags = HideFlags.HideAndDontSave;
				mInst = go.AddComponent<UpdateManager>();
			}
		}
	}
コード例 #20
0
		private ParticleSystemHotLoader(UpdateManager updateManager, ParticleSystem system, string pathToShaderSystem)
		{
			if (system == null || updateManager == null)
				throw new ArgumentNullException();

			if (system.ParticleSystemData == null)
				throw new ArgumentNullException("ParticleSystem.ParticleSystemData");
			
			this.system = new WeakReference(system);
			this.filename = system.ParticleSystemData.FileName;
			this.pathToShaderSystem = pathToShaderSystem;

			this.sourceFileModifiedDate = File.GetLastWriteTime(this.filename);

			updateManager.Add(this);
		}
コード例 #21
0
			internal AnimationProcessor(UpdateManager manager, object parent)
			{
				if (manager != null)
				{
					manager.Add(this);
					isAsync = true;

					if (parent != null)
					{
						parents = new List<WeakReference>();
						parents.Add(new WeakReference(parent));
					}

					threadAnimations = new List<AnimationStreamControl>();
				}
				animations = new List<AnimationStreamControl>();

				wasDrawn = true;
			}
コード例 #22
0
        public void NewReleasesShouldBeDetected()
        {
            var openPath = new Func<string, Stream>(s => {
                Assert.Equal(s, Path.Combine("packages", "RELEASES"));
                return File.OpenRead(IntegrationTestHelper.GetPath("fixtures", "RELEASES-OnePointOh"));
            });

            var downloadUrl = new Func<string, IObservable<string>>(url => {
                var path = IntegrationTestHelper.GetPath("fixtures", "RELEASES-OnePointOne");
                return Observable.Return(File.ReadAllText(path, Encoding.UTF8));
            });

            var fixture = new UpdateManager("http://lol", openPath, downloadUrl);
            var result = fixture.CheckForUpdate().First();

            Assert.NotNull(result);
            Assert.Equal(1, result.Version.Major);
            Assert.Equal(1, result.Version.Minor);
        }
コード例 #23
0
		//load the avatar
		public Avatar(ContentRegister content, UpdateManager update, out bool contentLoaded)
		{
			//create a random avatar description...
			Microsoft.Xna.Framework.GamerServices.AvatarDescription description;
			description = Microsoft.Xna.Framework.GamerServices.AvatarDescription.CreateRandom();

			//Create the avatar instance
			avatar = new AvatarInstance(description, true);


			//Create the animation controller.
			animationController = avatar.GetAnimationController();

			//NOTE: Animations cannot be played until the avatar animation data has been loaded...
			update.Add(this);

			//to play animations from a file, the user must download additional content.
			//however, we don't want to crash if they haven't... so only crash if the debugger is present
			//this will allow the user to download the content.
			contentLoaded = false;

			try
			{
				content.Add(this);
				contentLoaded = true;
			}
			catch
			{
				content.Remove(this);	//failed! but don't crash
			}

			if (contentLoaded)
			{
				//At this point in this tutorial, the animation is now loaded.

				//get the index of the walk animation
				int animationIndex = animationController.AnimationIndex("Walk");

				//begin playing the animation, looping
				walkAnimation = animationController.PlayLoopingAnimation(animationIndex);
			}
		}
コード例 #24
0
 public void CheckThereAreTwoPackagesForIntegrationTests()
 {
     string appPathBase;
     using (CreateTempTestPath(out appPathBase)) {
         var sut = new UpdateManager(APP_NAME, null, PackageSource, appPathBase, _nuGetCachePathForTests);
         sut.CheckForUpdate();
         Assert.AreEqual(2, sut.AvailableUpdates.Count());
     }
 }
コード例 #25
0
 void UnregisterManagers()
 {
     UpdateManager.Unregister();
 }
コード例 #26
0
 public void Uninstall()
 {
     UpdateManager.Unsubscribe(OnUpdate);
 }
コード例 #27
0
        private static void Main(string[] args)
        {
            ThisProcess = Process.GetCurrentProcess();

            CommandLineArgs = args;
            Console.Title   = WindowTitle;

            new FolderStructure().Build();

            m_config  = new Config();
            debugMode = m_config.Settings.DebugMode;

            var path = Path.Combine(Environment.CurrentDirectory, "Newtonsoft.Json.dll");

            if (File.Exists(path))
            {
                try
                {
                    var name = AssemblyName.GetAssemblyName(path);

                    if (name.Version < new Version("10.0.0.0"))
                    {
                        using (Stream s = Assembly.GetCallingAssembly().GetManifestResourceStream("HellionExtendedServer.Resources.Newtonsoft.Json.dll"))
                        {
                            byte[] data = new byte[s.Length];
                            s.Read(data, 0, data.Length);

                            File.WriteAllBytes(path, data);
                        }
                    }
                }
                catch (Exception) { }
            }
            else
            {
                try
                {
                    using (Stream s = Assembly.GetCallingAssembly().GetManifestResourceStream("HellionExtendedServer.Resources.Newtonsoft.Json.dll"))
                    {
                        byte[] data = new byte[s.Length];
                        s.Read(data, 0, data.Length);

                        File.WriteAllBytes(path, data);
                    }
                }
                catch (Exception)
                {
                }
            }

            AppDomain.CurrentDomain.AssemblyResolve += (sender, rArgs) =>
            {
                string assemblyName = new AssemblyName(rArgs.Name).Name;
                if (assemblyName.EndsWith(".resources"))
                {
                    return(null);
                }

                string dllName     = assemblyName + ".dll";
                string dllFullPath = Path.Combine(Path.GetFullPath("Hes\\bin"), dllName);

                if (dllName == "Newtonsoft.Json.dll")
                {
                    try
                    {
                        if (new AssemblyName(rArgs.Name).Version < new Version("10.0.0.0"))
                        {
                            using (Stream s = Assembly.GetCallingAssembly().GetManifestResourceStream("HellionExtendedServer.Resources.Newtonsoft.Json.dll"))
                            {
                                byte[] data = new byte[s.Length];
                                s.Read(data, 0, data.Length);

                                File.WriteAllBytes(path, data);
                            }
                            return(Assembly.LoadFrom(path));
                        }
                    }
                    catch (Exception)
                    {
                    }
                }

                if (debugMode)
                {
                    Console.WriteLine($"The assembly '{dllName}' is missing or has been updated. Adding/Updating missing assembly.");
                }

                using (Stream s = Assembly.GetCallingAssembly().GetManifestResourceStream("HellionExtendedServer.Resources." + dllName))
                {
                    byte[] data = new byte[s.Length];
                    s.Read(data, 0, data.Length);

                    File.WriteAllBytes(dllFullPath, data);
                }

                return(Assembly.LoadFrom(dllFullPath));
            };

            // This is for args that should be used before HES loads
            bool noUpdateHes           = false;
            bool noUpdateHellion       = false;
            bool usePrereleaseVersions = false;

            Console.ForegroundColor = ConsoleColor.Green;
            foreach (string arg in args)
            {
                if (arg.Equals("-noupdatehes"))
                {
                    noUpdateHes = true;
                }

                if (arg.Equals("-noupdatehellion"))
                {
                    noUpdateHellion = true;
                }

                if (arg.Equals("-usedevversion"))
                {
                    usePrereleaseVersions = true;
                }
            }

            if (usePrereleaseVersions || Config.Settings.EnableDevelopmentVersion)
            {
                Console.WriteLine("HellionExtendedServer: (Arg: -usedevversion is set) HES Will use Pre-releases versions");
            }

            if (noUpdateHes || !Config.Settings.EnableAutomaticUpdates)
            {
                UpdateManager.EnableAutoUpdates = false;
                Console.WriteLine("HellionExtendedServer: (Arg: -noupdatehes is set or option in HES config is enabled) HES will not be auto-updated.\r\n");
            }

            if (noUpdateHellion || !Config.Settings.EnableHellionAutomaticUpdates)
            {
                SteamCMD.AutoUpdateHellion = false;
                Console.WriteLine("HellionExtendedServer: (Arg: -noupdatehellion is set) Hellion Dedicated will not be auto-updated.");
            }

            Console.ResetColor();

            updateManager = new UpdateManager();

            var program = new HES(args);

            program.Run(args);
        }
コード例 #28
0
 public override void OnEnable()
 {
     base.OnEnable();
     StartCoroutine(ClientWaitForProvider());
     UpdateManager.Add(CallbackType.UPDATE, UpdateMe);
 }
コード例 #29
0
		/// <summary>
		/// Construct the camera
		/// </summary>
		/// <param name="updateManager"></param>
		/// <param name="startPosition"></param>
		public FirstPersonControlledCamera3D(UpdateManager updateManager, Vector3 startPosition)
			: this(updateManager, startPosition, false)
		{
		}
コード例 #30
0
 public ReadParams(UpdateManager updateManager, int cycleMs = 60000)
     : base(cycleMs, updateManager, "sss")
 {
     Iteration();
 }
コード例 #31
0
 private void OnEnable()
 {
     RefreshPlayerList();
     UpdateManager.Add(PeriodicUpdate, refreshTime);
 }
コード例 #32
0
 private void Awake()
 {
     Instance = this;
     DontDestroyOnLoad(gameObject);
 }
コード例 #33
0
 private void OnEnable()
 {
     RefreshPlayerList();
     UpdateManager.Add(CallbackType.UPDATE, UpdateMe);
 }
コード例 #34
0
 public void Dispose()
 {
     UpdateManager.Unsubscribe(this.OnUpdate);
     this.context.ParticleManger.ParticleAdded -= this.OnParticleAdded;
     this.context.Renderer.Draw -= this.OnDraw;
 }
コード例 #35
0
 private async void Update_Click(object sender, EventArgs e)
 {
     await UpdateManager.Check(true);
 }
コード例 #36
0
		/// <summary>
		/// Construct the camera
		/// </summary>
		/// <param name="updateManager"></param>
		/// <param name="startPosition"></param>
		/// <param name="zUp">If true, the Z-Axis is treated as the up/down axis, otherwise Y-Axis is treated as up/down</param>
		/// <param name="projection"></param>
		public FirstPersonControlledCamera3D(UpdateManager updateManager, Vector3 startPosition, bool zUp, Projection projection)
			: base(updateManager, projection)
		{
			this.zUp = zUp;
			CameraMatrix = Matrix.CreateLookAt(startPosition, startPosition + new Vector3(1, 0, 0), new Vector3(0, 0, 1));
			this.Position = startPosition;
		}
コード例 #37
0
 protected override void OnDeactivate()
 {
     UpdateManager.Unsubscribe(this.OnInventoryUpdate);
     UpdateManager.Unsubscribe(this.OnInventoryClear);
 }
コード例 #38
0
 void OnDisable()
 {
     UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, UpdateMe);
 }
コード例 #39
0
 private void OnDisable()
 {
     displaySettings.SettingsChanged -= DisplaySettings_SettingsChanged;
     SceneManager.activeSceneChanged -= SceneManager_activeSceneChanged;
     UpdateManager.Remove(CallbackType.UPDATE, UpdateMe);
 }
コード例 #40
0
        public async Task <bool> CastAsync(Unit enemy)
        {
            InAction = true;
            InvokerCrappahilationPaid.Log.Warn("[Async] IceWall Start");
            if (!Invoke())
            {
                InvokerCrappahilationPaid.Log.Warn("[Async] IceWall cant invoke");
                InAction = false;
                return(false);
            }

            Player.OnExecuteOrder += PlayerOnOnExecuteOrder;
            Owner.Stop();
            await Task.Delay((int)(Game.Ping + 150));

            Vector3 pos;
            float   num1;

            if (!enemy.IsMoving || enemy.HasAnyModifiers("modifier_invoker_deafening_blast_knockback"))
            {
                num1 = Owner.TurnTime(enemy.NetworkPosition) + 0.1f;
                Owner.Move(enemy.NetworkPosition);
                pos = enemy.NetworkPosition;
            }
            else
            {
                pos  = enemy.InFront(enemy.MovementSpeed * 0.6f);
                num1 = Owner.TurnTime(pos) + 0.1f;
                Owner.Move(pos);
            }

            if (num1 > 0.0)
            {
                await Task.Delay((int)(num1 * 1000.0));
            }
            Owner.Stop();
            var delay = Game.Ping > 1.0 ? Game.Ping / 1000f : Game.Ping;
            await Task.Delay((int)(delay * 1000.0));

            var num2     = 220f / Vector3Extensions.Distance(pos, Owner.NetworkPosition);
            var num3     = Owner.NetworkRotationRad - (float)Math.Acos(num2);
            var position = new Vector3(Owner.NetworkPosition.X + (float)(Math.Cos(num3) * 10.0),
                                       Owner.NetworkPosition.Y + (float)(Math.Sin(num3) * 10.0), Owner.NetworkPosition.Z);
            var num4 = Owner.TurnTime(position) + 0.1f;

            Owner.MoveToDirection(position);
            if (num4 > 0.0)
            {
                await Task.Delay((int)(num4 * 1000.0));
            }
            Owner.Stop();
            Player.OnExecuteOrder -= PlayerOnOnExecuteOrder;

            InvokerCrappahilationPaid.Log.Warn("[Async] IceWall End (phase 1)");
            UpdateManager.BeginInvoke(() =>
            {
                InvokerCrappahilationPaid.Log.Warn("[Async] IceWall End (phase 2)");
                InAction = false;
            }, (int)(Game.Ping * 3f));
            return(UseAbility());
            //await Task.Delay((int)(100.0 + delay));
        }
コード例 #41
0
ファイル: AbilityRange.cs プロジェクト: vana41203/O9K
 private void DelayedRedraw()
 {
     UpdateManager.BeginInvoke(this.RedrawRange);
 }
コード例 #42
0
ファイル: PounceEvadable.cs プロジェクト: vana41203/O9K
        public void AddParticle(ParticleEffect particle, string name)
        {
            var time = Game.RawGameTime - (Game.Ping / 2000);

            if (this.Owner.IsVisible)
            {
                var startPosition = this.Owner.Position;

                UpdateManager.BeginInvoke(
                    () =>
                {
                    try
                    {
                        if (!particle.IsValid)
                        {
                            return;
                        }

                        var endPosition = particle.GetControlPoint(0);

                        var obstacle = new LinearProjectileObstacle(this, startPosition, endPosition)
                        {
                            EndCastTime     = time,
                            EndObstacleTime = time + (this.RangedAbility.Range / this.RangedAbility.Speed)
                        };

                        this.Pathfinder.AddObstacle(obstacle);
                    }
                    catch (Exception e)
                    {
                        Logger.Error(e);
                    }
                },
                    10);
            }
            else
            {
                UpdateManager.BeginInvoke(
                    async() =>
                {
                    try
                    {
                        if (!particle.IsValid)
                        {
                            return;
                        }

                        var startPosition = particle.GetControlPoint(0);

                        await Task.Delay(50);

                        if (!particle.IsValid)
                        {
                            return;
                        }

                        var endPosition = particle.GetControlPoint(0);

                        var obstacle = new LinearProjectileObstacle(this, startPosition, endPosition)
                        {
                            EndCastTime     = time,
                            EndObstacleTime = time + (this.RangedAbility.Range / this.RangedAbility.Speed)
                        };

                        this.Pathfinder.AddObstacle(obstacle);
                    }
                    catch (Exception e)
                    {
                        Logger.Error(e);
                    }
                });
            }
        }
コード例 #43
0
        private async Task Update(bool allowSkip = true, bool notifyUser = false)
        {
            try {
                var assetNamePattern = Environment.Is64BitProcess ? "release_x64.zip" : "release.zip";
                var updateManager    = new UpdateManager("OliBomby", "Mapping_Tools", assetNamePattern);
                var hasUpdate        = await updateManager.FetchUpdateAsync();

                if (!hasUpdate)
                {
                    if (notifyUser)
                    {
                        MessageQueue.Enqueue("No new versions available.");
                    }
                    return;
                }

                // Check if this version is newer than the version we skip
                var skipVersion = SettingsManager.Settings.SkipVersion;
                if (allowSkip && skipVersion != null && !(updateManager.UpdatesResult.LastVersion > skipVersion))
                {
                    if (notifyUser)
                    {
                        MessageQueue.Enqueue($"Version {updateManager.UpdatesResult.LastVersion} skipped because of user config.");
                    }
                    return;
                }

                Dispatcher.Invoke(() => {
                    _updaterWindow = new UpdaterWindow(updateManager.Progress)
                    {
                        ShowActivated = true
                    };

                    _updaterWindow.ActionSelected += async(sender, action) => {
                        switch (action)
                        {
                        case UpdateAction.Restart:
                            await updateManager.DownloadUpdateAsync();
                            updateManager.RestartAfterUpdate = true;
                            updateManager.StartUpdateProcess();

                            _updaterWindow.Close();
                            Close();
                            break;

                        case UpdateAction.Wait:
                            await updateManager.DownloadUpdateAsync();
                            updateManager.RestartAfterUpdate = false;
                            updateManager.StartUpdateProcess();

                            _updaterWindow.Close();
                            break;

                        case UpdateAction.Skip:
                            // Update the skip version so we skip this version in the future
                            SettingsManager.Settings.SkipVersion = updateManager.UpdatesResult.LastVersion;
                            _updaterWindow.Close();
                            break;

                        default:
                            _updaterWindow.Close();
                            break;
                        }
                    };

                    _updaterWindow.Closed += (sender, e) => {
                        updateManager.Dispose();
                    };

                    _updaterWindow.Show();
                });
            } catch (Exception e) {
                MessageBox.Show("UPDATER_EXCEPTION: " + e.Message);
                if (notifyUser)
                {
                    MessageQueue.Enqueue("Error fetching update: " + e.Message);
                }
            }
        }
コード例 #44
0
 public void OnDestroy()
 {
     UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, UpdateMe);
 }
コード例 #45
0
        public async Task UpdateApp(bool silentIfLatestVersion = true)
        {
            try
            {
                using (UpdateManager updateManager = await GitHubUpdateManager(GitHubRepository))
                {
                    UpdateInfo newUpdateInfo;
                    try
                    {
                        // UpdateApp CheckForUpdate will return value only if the app is squirrel installed
                        newUpdateInfo = await updateManager.CheckForUpdate().NonNull();
                    }
                    catch (Exception e) when(e is HttpRequestException || e is WebException || e is SocketException)
                    {
                        Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to api.github.com.", e);
                        updateManager.Dispose();
                        return;
                    }

                    var newReleaseVersion = Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString());
                    var currentVersion    = Version.Parse(Constant.Version);

                    Log.Info($"|Updater.UpdateApp|Future Release <{newUpdateInfo.FutureReleaseEntry.Formatted()}>");

                    if (newReleaseVersion <= currentVersion)
                    {
                        if (!silentIfLatestVersion)
                        {
                            MessageBox.Show("You already have the latest Wox version");
                        }
                        updateManager.Dispose();
                        return;
                    }

                    try
                    {
                        await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply);
                    }
                    catch (Exception e) when(e is HttpRequestException || e is WebException || e is SocketException)
                    {
                        Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
                        updateManager.Dispose();
                        return;
                    }

                    await updateManager.ApplyReleases(newUpdateInfo);

                    if (DataLocation.PortableDataLocationInUse())
                    {
                        var targetDestination = updateManager.RootAppDirectory + $"\\app-{newReleaseVersion.ToString()}\\{DataLocation.PortableFolderName}";
                        FilesFolders.Copy(DataLocation.PortableDataPath, targetDestination);
                        if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination))
                        {
                            MessageBox.Show(string.Format("Wox was not able to move your user profile data to the new update version. Please manually" +
                                                          "move your profile data folder from {0} to {1}", DataLocation.PortableDataPath, targetDestination));
                        }
                    }
                    else
                    {
                        await updateManager.CreateUninstallerRegistryEntry();
                    }

                    var newVersionTips = NewVersinoTips(newReleaseVersion.ToString());

                    MessageBox.Show(newVersionTips);
                    Log.Info($"|Updater.UpdateApp|Update success:{newVersionTips}");
                }
            }
            catch (Exception e) when(e is HttpRequestException || e is WebException || e is SocketException)
            {
                Log.Exception($"|Updater.UpdateApp|Please check your connection and proxy settings to api.github.com.", e);
            }
        }
コード例 #46
0
ファイル: TowerTarget.cs プロジェクト: vana41203/O9K
 public void Dispose()
 {
     this.show.ValueChange -= this.ShowOnValueChange;
     UpdateManager.Unsubscribe(this.handler);
     Entity.OnHandlePropertyChange -= this.OnHandlePropertyChange;
 }
コード例 #47
0
 public void Install()
 {
     UpdateManager.Subscribe(OnUpdate, 50);
 }
コード例 #48
0
 private async void UpdaterWindow_OnContentRendered(object sender, EventArgs e)
 {
     using var updateManager = UpdateManager.GitHubUpdateManager("https://github.com/HendrikKoelbel/WinControlTool");
     await updateManager.Result.UpdateApp(this.UpdateProgress);
 }
コード例 #49
0
 void CheckForUpdates()
 {
     // Remove this for store builds!
     UpdateManager.Register(this, HocKeyApp_ID);
 }
コード例 #50
0
 public void Dispose()
 {
     UpdateManager.Unsubscribe(OnUpdate);
     Player.OnExecuteOrder -= OnExecuteOrder;
     menu.OnAbuseChange    -= OnAbuseChange;
 }
コード例 #51
0
ファイル: RustAPI.cs プロジェクト: Riketta/rust-anticheat
 public static void AddLateUpdate(MonoBehaviour mb, int updateOrder, UpdateManager.OnUpdate func)
 {
     UpdateManager.AddLateUpdate(mb, updateOrder, func);
 }
コード例 #52
0
 public void Dispose()
 {
     menu.OnEnabledChange -= MenuOnEnabledChange;
     UpdateManager.Unsubscribe(OnUpdate);
 }
コード例 #53
0
 private void OnEnable()
 {
     UpdateManager.Add(CallbackType.UPDATE, UpdateMe);
     OnStart();
 }
コード例 #54
0
 private void OnDisable()
 {
     UpdateManager.Remove(CallbackType.PERIODIC_UPDATE, PeriodicUpdate);
 }
コード例 #55
0
		/// <summary>
		/// Construct the camera
		/// </summary>
		/// <param name="updateManager"></param>
		public FirstPersonControlledCamera3D(UpdateManager updateManager)
			: this(updateManager, Vector3.Zero)
		{
		}
コード例 #56
0
 private void OnDisable()
 {
     UpdateManager.Remove(CallbackType.UPDATE, UpdateMe);
 }
コード例 #57
0
		/// <summary>
		/// Construct the camera
		/// </summary>
		/// <param name="updateManager"></param>
		/// <param name="startPosition"></param>
		/// <param name="zUp">If true, the Z-Axis is treated as the up/down axis, otherwise Y-Axis is treated as up/down</param>
		public FirstPersonControlledCamera3D(UpdateManager updateManager, Vector3 startPosition, bool zUp)
			: this(updateManager, startPosition, zUp, new Projection())
		{
		}
コード例 #58
0
 private void StartMicrowave()
 {
     UpdateManager.Add(CallbackType.UPDATE, UpdateMe);
     SoundManager.PlayNetworkedAtPos("MicrowaveStart", WorldPosition, sourceObj: gameObject);
     playAudioLoop = true;
 }
コード例 #59
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="updaterManager"></param>
		/// <param name="projection"></param>
		public ControlledCamera3D(UpdateManager updaterManager, Projection projection)
			: base(projection, Matrix.Identity)
		{
			if (updaterManager != null)
				updaterManager.Add(this);
		}
コード例 #60
0
 private void HaltMicrowave()
 {
     UpdateManager.Remove(CallbackType.UPDATE, UpdateMe);
     playAudioLoop = false;
 }