private void LoginProcess(ApplicationTime time) { if (Ox.DataStore.World.Status.Status < StatusData.Type.Login || StatusData.Type.Running < Ox.DataStore.World.Status.Status) return; float progress_max = StatusData.PROGRESS_MAX; float progress_now = 0; if (StatusData.Type.Login < Ox.DataStore.World.Status.Status) progress_now += (RATE_LOGIN * progress_max); SimData sim; if (Ox.DataStore.World.TryGetCurrentSim(out sim)) { float content_max = (force_wait_second * Ox.DataStore.Core.FpsActiveTarget); progress_now += (RATE_LANDPATCH * progress_max * ((float)sim.Terrain.PatchCount / TerrainData.PATCH_MAX)); if (sim.Terrain.PatchCount == TerrainData.PATCH_MAX) { progress_now += RATE_LANDPATCH * progress_max * (content_load_counter / content_max); if (content_load_counter < content_max) content_load_counter++; } } if (progress_now < auto_increment_counter) progress_now = auto_increment_counter; if (progress_now > progress_max) progress_now = progress_max; Ox.DataStore.World.Status.Progress = (int)progress_now; auto_increment_counter += (StatusData.PROGRESS_MAX / auto_increment_rate) * (float)time.ElapsedTime.TotalSeconds; }
public override void Update(ApplicationTime time) { if (node != null) { node.Position = Util.ToPositionRH(Ox.DataStore.World.Point.Position); node.Visible = true; Color c = Color.Black; switch (Ox.DataStore.World.Point.Type) { case PointData.ObjectType.None: node.Visible = false; break; case PointData.ObjectType.Avatar: c = Color.Blue; break; case PointData.ObjectType.AvatarSelf: c = Color.Purple; break; case PointData.ObjectType.Prim: c = Color.Red; break; case PointData.ObjectType.Ground: c = Color.Gray; break; } for (int i = 0; i < node.MaterialCount; i++) node.GetMaterial(i).EmissiveColor = c; } base.Update(time); }
public override void Update(ApplicationTime time) { if ((UpdateCount % RATE_CALCCOLLISION) == 0) CalcCollision(); base.Update(time); }
public override void Update(ApplicationTime time) { LoginProcess(time); LogoutProcess(time); base.Update(time); }
public override void Update(ApplicationTime time) { IOxRenderPluginAvatar avatar = (IOxRenderPluginAvatar)Ox.Service.Get(typeof(IOxRenderPluginAvatar)); SceneNode sn = avatar.GetAvatarScneNode(Ox.DataStore.World.Agent.ID); if (sn == null || node == null) return; node.Target = sn.Position + Render.RenderData.AgentHeadPosition; Matrix4 rot = new Matrix4(); //rot.RotationDegrees = Util.ToRotationRH(new float[] { // 0, // 0, // (float)(Ox.DataStore.World.Agent.Head * NewMath.RADTODEG) + Util.ROTATION_AND_3DS_OFFSET.Z }); Quaternion q0 = new Quaternion(); Quaternion q1 = new Quaternion(); q0.fromAngleAxis(Ox.DataStore.Camera.Angle[0] + NewMath.DEGTORAD * Util.ROTATION_AND_3DS_OFFSET.Z, new Vector3D(0, 0, 1)); q1.fromAngleAxis(Ox.DataStore.Camera.Angle[1], new Vector3D(1, 0, 0)); q1 = q1 * q0; Vector3D vec = new Vector3D(0, -Ox.DataStore.Camera.Distance, 0); node.Position = node.Target + q1.Matrix.RotateVect(ref vec); if (Ox.DataStore.Camera.Angle[1] < -MathHelper.PIOver2 || MathHelper.PIOver2 < Ox.DataStore.Camera.Angle[1]) node.UpVector = new Vector3D(0, 0, -1); else node.UpVector = new Vector3D(0, 0, 1); base.Update(time); }
public override void Update(ApplicationTime time) { if (action != null) { action(this, EventArgs.Empty); action = null; } base.Update(time); }
private void LogoutProcess(ApplicationTime time) { if (Ox.DataStore.World.Status.Status < StatusData.Type.Logout || StatusData.Type.Waiting < Ox.DataStore.World.Status.Status) return; float progress_now = auto_increment_counter; if (progress_now < 0) progress_now = 0; Ox.DataStore.World.Status.Progress = (int)progress_now; auto_increment_counter -= (StatusData.PROGRESS_MAX / auto_increment_rate) * (float)time.ElapsedTime.TotalSeconds; }
public override void Update(ApplicationTime time) { framecount++; if (sw.ElapsedMilliseconds >= (updateIntervalSecond * 1000)) { fps = framecount / updateIntervalSecond; framecount = 0; sw.Reset(); sw.Start(); } elem.Text = fps.ToString(); base.Update(time); }
public override void Update(ApplicationTime time) { while (pipline.Count > 0) { JsonObjectUpdated j; lock (pipline) j = pipline.Dequeue(); if (Ox.DataStore.World.Status.Status < StatusData.Type.LoginEnd || StatusData.Type.Logout <= Ox.DataStore.World.Status.Status) continue; if (string.IsNullOrEmpty(j.id)) continue; IOxRenderPluginAvatar avatar = (IOxRenderPluginAvatar)Ox.Service.Get(typeof(IOxRenderPluginAvatar)); if (avatar != null) { ObjectData[] datas = Ox.DataStore.World.SimCollection.GetAvatarAll(); if (datas != null) { foreach (ObjectData data in datas) { if (!(data is AvatarData)) continue; AvatarData avatarData = data as AvatarData; SceneNode node = avatar.GetAvatarScneNode(avatarData.ID); if (node == null) return; switch (j.type) { case (int)JsonObjectUpdated.Type.Add: Create(avatarData.ID, node, avatarData.First, avatarData.Last); break; case (int)JsonObjectUpdated.Type.Delete: Delete(avatarData.ID); break; } } } } } base.Update(time); }
public override void Update(ApplicationTime time) { while (queue.Count > 0) { lock (queue) progress.Visible = queue.Dequeue(); } if (progress.Visible) { int value = Ox.DataStore.World.Status.Progress; if (value > StatusData.PROGRESS_MAX) value = StatusData.PROGRESS_MAX; progress.Value = value; } base.Update(time); }
public override void Update(ApplicationTime time) { Ox.DataStore.World.Point.Clear(); ProcessProgress(); ProcessAllUserControl(); if (Ox.DataStore.World.Status.Status == StatusData.Type.Waiting) { ProcessWaitingUserControl(); } else if (Ox.DataStore.World.Status.Status == StatusData.Type.Running) { ProcessRunningUserControl(); } if ((counter >= 0) && (counter += time.ElapsedTime.TotalSeconds) > FADE_TIME_SECOND) { counter = -1; if (Ox.DataStore.World.Status.Status == StatusData.Type.RunningFade) { counter = FADE_TIME_SECOND - 0.2f; Ox.EventFire(JsonUtil.SerializeMessage(JsonType.StateInside, new JsonState((int)StatusData.Type.RunningBef)), false); } else if (Ox.DataStore.World.Status.Status == StatusData.Type.RunningBef) { Ox.EventFire(JsonUtil.SerializeMessage(JsonType.StateInside, new JsonState((int)StatusData.Type.Running)), false); } else if (Ox.DataStore.World.Status.Status == StatusData.Type.WaitingFade) { counter = FADE_TIME_SECOND - 0.2f; Ox.EventFire(JsonUtil.SerializeMessage(JsonType.StateInside, new JsonState((int)StatusData.Type.WaitingBef)), false); } else if (Ox.DataStore.World.Status.Status == StatusData.Type.WaitingBef) { Ox.EventFire(JsonUtil.SerializeMessage(JsonType.StateInside, new JsonState((int)StatusData.Type.Waiting)), false); } } base.Update(time); }
public override void Update(ApplicationTime time) { while (pipline.Count > 0) { JsonObjectUpdated j; lock (pipline) j = pipline.Dequeue(); switch (j.type) { case (int)JsonObjectUpdated.Type.Add: case (int)JsonObjectUpdated.Type.Update: UpdateObject(ref j); break; } } CalcAgentHead(); base.Update(time); }
public override void Update(ApplicationTime time) { while (pipline.Count > 0) { StatusData.Type type = StatusData.Type.None; lock (pipline) type = pipline.Dequeue(); if (Ox.DataStore.World.Status.Status != type) { JsonState.Type t = JsonState.Type.None; switch (type) { case StatusData.Type.Initialize: t = JsonState.Type.Initialize; break; case StatusData.Type.InitializeEnd: type = StatusData.Type.Waiting; break; case StatusData.Type.Running: t = JsonState.Type.Login; break; case StatusData.Type.Waiting: t = JsonState.Type.Logout; break; case StatusData.Type.CleanupEnd: t = JsonState.Type.Cleanup; break; } Ox.DataStore.World.Status.Status = type; // send outside (to js) if (t != JsonState.Type.None) Ox.EventFire(JsonUtil.SerializeMessage(JsonType.State, new JsonState((int)t)), false); } } base.Update(time); }
public override void Update(ApplicationTime time) { if (Ox.DataStore.Input.ReleaseTrg(KeyType.Key_1)) { type++; if (type > Type.System) type = Type.None; switch(type) { case Type.Agent: action = InfoAgent; break; case Type.World: action = InfoWorld; break; case Type.System: action = InfoSystem; break; default: action = null; break; } } if (action == null) { sb = null; elem.Text = string.Empty; } else { action(this, EventArgs.Empty); elem.Text = sb.ToString(); } base.Update(time); }
public override void Update(ApplicationTime time) { while (pipline.Count > 0) { int state; lock (pipline) state = pipline.Dequeue(); switch (state) { case (int)StatusData.Type.RunningFade: f = new OxUtil.Fade(FADE_SPEED, WAIT_MILLISECOND, OxUtil.Alpha.FpsType.Fps30); f.OnEnd += new EventHandler(f_OnEnd); break; case (int)StatusData.Type.WaitingFade: f = new OxUtil.Fade(FADE_SPEED, WAIT_MILLISECOND, OxUtil.Alpha.FpsType.Fps30); f.OnEnd += new EventHandler(f_OnEnd); break; } } base.Update(time); }
private void Start() { using (Form form = new Form()) { form.Width = DataStore.Width; form.Height = DataStore.Height; form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; form.ImeMode = System.Windows.Forms.ImeMode.Inherit; form.Activated += new EventHandler(form_Activated); form.Deactivate += new EventHandler(form_Deactivate); SetParent(form.Handle, handle); form.Location = new Point(0, 0); form.Show(); handle = form.Handle; component.Sort(); Initialize(); runnning = true; OxComponent[] ocs = component.GetAll(); ApplicationTime time = new ApplicationTime(); System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); while (runnning) { if (sw.ElapsedMilliseconds >= targetElapsedTime.TotalMilliseconds) { time.Update(sw.Elapsed); sw.Reset(); sw.Start(); Update(); foreach (OxComponent oc in ocs) oc.Update(time); foreach (OxComponent oc in ocs) if (oc is IDrawable) ((OxDrawableComponent)oc).Draw(); } Thread.Sleep(1); } Cleanup(); foreach (OxComponent oc in ocs) oc.Dispose(); form.Close(); } }
public override void Update(ApplicationTime time) { while (pipline.Count > 0) { JsonObjectUpdated j; lock (pipline) j = pipline.Dequeue(); if (Ox.DataStore.World.Status.Status < StatusData.Type.LoginEnd || StatusData.Type.Logout <= Ox.DataStore.World.Status.Status) continue; if (string.IsNullOrEmpty(j.id)) continue; switch (j.type) { case (int)JsonObjectUpdated.Type.Add: case (int)JsonObjectUpdated.Type.UpdateFull: CreatePrim(ref j); j.type = (int)JsonObjectUpdated.Type.Update; pipline.Enqueue(j); break; case (int)JsonObjectUpdated.Type.Update: UpdatePrim(ref j); break; case (int)JsonObjectUpdated.Type.Delete: DeletePrim(j.id); break; } } base.Update(time); }
public override void Update(ApplicationTime time) { if (changed) { if (CheckedChanged != null) CheckedChanged(this, EventArgs.Empty); for (int i = 0; i < visible.Length; i++) Ox.Config.Add(this.GetType(), ((Type)i).ToString(), visible[i]); changed = false; } base.Update(time); }
public override void Update(ApplicationTime time) { while (pipline.Count > 0) { JsonObjectUpdated j; lock (pipline) j = pipline.Dequeue(); if (Ox.DataStore.World.Status.Status < StatusData.Type.LoginEnd || StatusData.Type.Logout <= Ox.DataStore.World.Status.Status) continue; if (string.IsNullOrEmpty(j.id)) continue; switch (j.type) { case (int)JsonObjectUpdated.Type.Add: CreateAvatar(ref j); UpdateAvatar(ref j); UpdateAvatarAnimation(ref j); break; case (int)JsonObjectUpdated.Type.Update: UpdateAvatar(ref j); break; case (int)JsonObjectUpdated.Type.UpdateAnimation: UpdateAvatarAnimation(ref j); break; case (int)JsonObjectUpdated.Type.Delete: DeleteAvatar(j.id); break; } } foreach (string key in list.Keys) { UpdatePosition(time, key); UpdateAnimation(key); } foreach (Data data in list.Values) data.Node.AnimateJoints(true); base.Update(time); }
private void UpdatePosition(ApplicationTime time, string key) { AnimatedMeshSceneNode node = list[key].Node; if (node == null) return; AvatarMoveData move = list[key].Move; if (move == null) return; Vector3D vec = move.Target - move.Current; float rate = ((float)time.ElapsedTime.TotalSeconds / (1.0f / Ox.DataStore.Core.FpsActiveTarget)); float lensq = vec.LengthSQ; float speed = (((move.Length / move.Span) > AVATAR_RUN_LENGTH) ? AVATAR_INTERPOLATE_RUN_SPEED : AVATAR_INTERPOLATE_WALK_SPEED) * rate; if (lensq <= (speed * speed) || (AVATAR_INTERPOLATE_SYNC_DISTANCE * AVATAR_INTERPOLATE_SYNC_DISTANCE) < lensq) { move.Current = move.Target; } else { vec = vec.Normalize(); move.Current += (vec * speed); } node.Position = move.Current; move.IncrementCount(); }
public override void Update(ApplicationTime time) { if (max != requestMax) max = requestMax; base.Update(time); }
public override void Update(ApplicationTime time) { while (queueControl.Count > 0) { ControlType type = ControlType.None; lock (queueControl) type = queueControl.Dequeue(); switch (type) { case ControlType.Load: LoadProcess(); break; case ControlType.Unload: UnloadProcess(); break; } } while (processQueue.Count > 0) { QueueBase q; lock (processQueue) q = processQueue.Dequeue(); if (q.Method == null) return; if (q.Args == null) q.Method.DynamicInvoke(); else q.Method.DynamicInvoke(q.Args); } base.Update(time); }
public override void Update(ApplicationTime time) { while (pipline.Count > 0) { JsonObjectUpdated j; lock (pipline) j = pipline.Dequeue(); if (Ox.DataStore.World.Status.Status < StatusData.Type.LoginEnd || StatusData.Type.Logout <= Ox.DataStore.World.Status.Status) continue; if (j.type == (int)JsonObjectUpdated.Type.Add || j.type == (int)JsonObjectUpdated.Type.Update) UpdatePosition(); } base.Update(time); }
public override void Update(ApplicationTime time) { if ((Ox.DataStore.World.Status.Status < StatusData.Type.RunningFade) || (StatusData.Type.WaitingBef < Ox.DataStore.World.Status.Status)) { while (downloaded.Count > 0) { string path = string.Empty; lock (downloaded) path = downloaded.Dequeue(); TextureInfo info = Render.Texture.GetTexture(path, false, false); list.Add(info.Texture); } if (!downloading && paths.Count > 0) { string path = string.Empty; lock (paths) path = paths.Dequeue(); downloading = true; Ox.IO.Download(path, Path.GetFileName(path), true); } } base.Update(time); }
public override void Update(ApplicationTime time) { while (queue.Count > 0) { PluginControlType type = PluginControlType.None; lock (queue) type = queue.Dequeue(); switch (type) { case PluginControlType.Load: LoadProcess(); break; case PluginControlType.Unload: UnloadProcess(); break; } } if (!device.WindowActive) ResetInput(); UpdateInput(); if (device == null || !device.Run()) return; base.Update(time); }
public virtual void Update(ApplicationTime time) { update_count = (update_count + 1) % int.MaxValue; }
public override void Update(ApplicationTime time) { System.Windows.Forms.Application.DoEvents(); base.Update(time); }