public PersonnelWoundsScene(Game game, BaseScene previousScene, List<Character> characters, int selected = 0) : base(game) { PreviousScene = previousScene; Characters = characters; UiLayout = Ui.UiLayout.Load("Assets/Layouts/CharacterScreenWounds.ui"); CharacterList = new Ui.UiList<Character>(Characters, RenderCharacterListItem); CharacterList.SelectedIndex = selected; }
public void RegisterLevel(BaseScene t_regScene) { if (!m_loadedScene.Contains(t_regScene)) { m_loadedScene.Add(t_regScene); } activeScene = t_regScene; StopLoadAnim(); }
/// <summary> /// Loads a scene where the sceneName does not exist in the current list of scenes /// </summary> /// <param name="scene">scene to be loaded</param> /// <returns>true if scene was loaded, false if scene is already loaded</returns> public bool LoadScene(BaseScene scene) { // TODO: support async loading of scenes, they could be complex and we don't want to be blocking // the UI threads. Should also provide progress updates for the UI thread to display progress // if (! scenes.ContainsKey(scene.SceneName)) { scenes.Add(scene.SceneName,scene); return true; } return false; }
// 设置场景变量 public static bool SetFloatParam(List <string> paramList) { if (paramList == null || paramList.Count != 2) { return(false); } BaseScene scene = SceneManager.Instance.GetCurScene(); if (scene == null) { return(false); } return(scene.SetFloatParam(int.Parse(paramList[0]), float.Parse(paramList[1]))); }
public override void Update(BaseScene scene, FrameTick elapsedTime) { CurrentShotTime += elapsedTime; while (CurrentShotTime >= BurstTime) { CurrentShotTime -= BurstTime; int range = Range; Vector2 totalDistance = (Dir.GetLoc() * (range - StartDistance)).ToVector2(); double angle = MathUtils.Rand.NextDouble() * Math.PI * 2; int dist = MathUtils.Rand.Next(EndDiff + 1); Vector2 endDelta = new Vector2((int)Math.Round(Math.Cos(angle) * dist), (int)Math.Round(Math.Sin(angle) * dist)); totalDistance += endDelta; //pixels float totalTime = range - StartDistance; //seconds if (Speed > 0) { totalTime /= Speed; } //pixels Vector2 particleSpeed = totalDistance; //pixels per second if (totalTime > 0) { particleSpeed /= totalTime; } Loc startDelta = Dir.GetLoc() * StartDistance; if (Anims.Count > 0) { IParticleEmittable chosenAnim = Anims[CurrentShots % Anims.Count]; scene.Anims[(int)Layer].Add(chosenAnim.CreateParticle((int)Math.Round(totalTime * GraphicsManager.MAX_FPS), Origin + startDelta, particleSpeed.ToLoc(), Loc.Zero, LocHeight, 0, 0, Dir)); } CurrentShots++; if (CurrentShots >= Shots) { break; } } }
public override void Update(BaseScene scene, FrameTick elapsedTime) { CurrentBurstTime += elapsedTime; while (CurrentBurstTime >= Math.Max(1, BurstTime)) { CurrentBurstTime -= Math.Max(1, BurstTime); for (int ii = 0; ii < ParticlesPerBurst; ii++) { if (Anims.Count > 0) { List <int> openDirs = getOpenDirs(); int openIndex = openDirs[MathUtils.Rand.Next(openDirs.Count)]; Coverages[openIndex] = true; double angle = (openIndex + MathUtils.Rand.NextDouble()) * Math.PI / 4; int dist = StartDistance + MathUtils.Rand.Next(StartVariance + 1); Loc startDelta = new Loc((int)Math.Round(Math.Cos(angle) * dist), (int)Math.Round(Math.Sin(angle) * dist)); double endAngle = MathUtils.Rand.NextDouble() * Math.PI * 2; int endDist = MathUtils.Rand.Next(EndDistance + 1); Loc endDelta = new Loc((int)Math.Round(Math.Cos(endAngle) * endDist), (int)Math.Round(Math.Sin(endAngle) * endDist)); Loc particleSpeed = ((UseDest ? Destination : Origin) + endDelta - (Origin + startDelta)) * GraphicsManager.MAX_FPS / TravelTime; Loc startLoc = Origin + startDelta; { AnimData animData = Anims[MathUtils.Rand.Next(Anims.Count)]; AnimData scaledAnim = new AnimData(animData); DirSheet fxSheet = GraphicsManager.GetAttackSheet(animData.AnimIndex); scaledAnim.FrameTime = (int)Math.Round((float)TravelTime / scaledAnim.GetTotalFrames(fxSheet.TotalFrames) / Math.Max(1, Cycles)); scaledAnim.FrameTime = Math.Max(1, scaledAnim.FrameTime); ParticleAnim anim = new ParticleAnim(scaledAnim, 0, TravelTime); anim.SetupEmitted(startLoc, particleSpeed, Loc.Zero, 0, 0, 0, particleSpeed.ApproximateDir8()); scene.Anims[(int)Layer].Add(anim); } } } CurrentBursts++; if (CurrentBursts >= Math.Max(1, Bursts)) { break; } } }
public override void Update(BaseScene scene, FrameTick elapsedTime) { CurrentBurstTime += elapsedTime; while (CurrentBurstTime >= Math.Max(1, BurstTime)) { CurrentBurstTime -= Math.Max(1, BurstTime); scene.Anims[(int)Layer].Add(Anim.CreateStatic(Origin + Dir.GetLoc() * Offset, LocHeight, Dir)); CurrentBursts++; if (CurrentBursts >= Math.Max(1, Bursts)) { break; } } }
/// <summary> /// 配置音乐源 /// </summary> /// <param name="audioSource"></param> static void setupAduioSource(BaseScene scene, AudioSource audioSource) { if (SceneUtils.audioSource == null && audioSource != null) { SceneUtils.audioSource = audioSource; UnityEngine.Object.DontDestroyOnLoad(audioSource); } if (SceneUtils.audioSource) { SceneUtils.audioSource.loop = true; if (scene.bgmClip && SceneUtils.audioSource.clip?.name != scene.bgmClip.name) { SceneUtils.audioSource.clip = scene.bgmClip; SceneUtils.audioSource.Play(); } } }
static public bool CanMoveTo(uint objId, Vector3f srcPos, Vector3f tarPos) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return(false); } ObjectBase obj = scn.FindObject(objId); if (obj == null) { return(false); } return(scn.FindPath(obj, new Vector2f(srcPos.x, srcPos.z), new Vector2f(tarPos.x, tarPos.z)) != null); }
/// <summary> /// 有进度条的异步加载 /// </summary> /// <param name="data"></param> /// <returns></returns> private IEnumerator <AsyncOperation> AsyncLoadOtherScene(SceneInfoData data) { string loadingName = GetName <LoadingScene>(); AsyncOperation oper = SceneManager.LoadSceneAsync(loadingName); yield return(oper); //load场景加载完成 if (oper.isDone) { UIManager.Instance.OpenPanel <LoadingPanel>(); CurrentScene = GetScene <LoadingScene>(); LoadLogicScene(data); } }
/// <summary> /// /// </summary> /// <param name="paramList"></param> /// <returns></returns> public static bool PlaySceneAni(List <string> paramList) { if (paramList == null || paramList.Count != 1) { return(false); } BaseScene scene = SceneManager.Instance.GetCurScene(); if (scene == null) { return(false); } scene.PlayGameObjAnim(paramList[0]); return(true); }
/// <summary> /// 加载场景 /// </summary> /// <param name="scene"></param> /// <param name="immediately">直接进入 主要用于StartScene</param> public void LoadScene(BaseScene scene, bool immediately = false) { if (mCurScene != null) { mCurScene.Exit(); } mCurScene = scene; if (immediately) { mCurScene.Enter(); } else { StartCoroutine(StartLoad()); } }
static public bool IsPlayer(uint objId) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return(false); } ObjectBase obj = scn.FindObject(objId); if (obj == null) { return(false); } return(ObjectType.IsPlayer(obj.Type)); }
static public bool RemoveBuffByResId(uint objId, int buffResId) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return(false); } BattleUnit unit = scn.FindObject(objId) as BattleUnit; if (unit == null) { return(false); } return(unit.RemoveSkillBuffByResID((uint)buffResId) == ErrorCode.Succeeded); }
static public void SetObjectPos(uint objId, Vector3f pos) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return; } ObjectBase obj = scn.FindObject(objId); if (obj == null) { return; } obj.SetPosition3f(pos); }
public bool scene_may_straight_reach(Vector3f source, Vector3f target) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return(false); } List <Vector2f> rst = scn.FindPath(mOwner, new Vector2f(source.x, source.z), new Vector2f(target.x, target.z)); if (rst == null) { return(false); } return(rst.Count == 2); }
static public void DestoryObject(uint objId) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return; } ObjectBase obj = scn.FindObject(objId); if (obj == null) { return; } obj.Disappear(); }
static public Vector3f GetPosition(uint objId) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return(new Vector3f()); } ObjectBase obj = scn.FindObject(objId); if (obj == null) { return(new Vector3f()); } return(obj.GetPosition3f()); }
public void LoadScene <T>() where T : BaseScene, new() { T t = new T(); if (currentScene != null && t.SceneName == currentScene.SceneName) { Debug.Log($"当前已经是 {t.SceneName} 场景"); return; } if (currentScene != null) { currentScene.active = false; currentScene.OnLeave(); } currentScene = t; SceneManager.LoadScene(currentScene.SceneName); }
static public float GetDirection(uint objId) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return(0.0f); } ObjectBase obj = scn.FindObject(objId); if (obj == null) { return(0.0f); } return(obj.GetDirection()); }
private void FaceToEnemy() { if (m_LockGameEnemy == null || m_LockGameEnemy.InDeath) { FindLockEnemy(); m_CurCheckTime = 0; } else { m_CurCheckTime = m_CurCheckTime + BaseScene.GetDtTime(); if (m_CurCheckTime >= m_CheckDtTime) { m_CurCheckTime = m_CurCheckTime - m_CheckDtTime; FindLockEnemy(); } } FaceToEnemyImp(); }
/// <summary> /// /// </summary> /// <param name="name"></param> public void ChangeScene(string name, params object[] param) { BaseScene scene = sceneDic.TryGet(name); if (scene == null) { Debug.LogError("scene is null"); return; } if (currentScene != null) { currentScene.Quit(); } currentScene = scene; currentScene.Open(param); }
/// <summary> /// 重置为初始位置 /// </summary> public void SetInitPos() { Player player = GetControlObj() as Player; if (player == null) { return; } BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return; } player.SetPosition(scn.GetInitPos()); player.SetDirection(scn.GetInitDir()); }
public void Initialize(BaseScene initialScene = null) { Logger.Initialize(); windowTitle = "Emergence"; Settings = LoadSettings("Assets/config.json"); if (Settings == null) { throw new Exception("Error loading config file."); } TCODConsole.setCustomFont($"Assets/Fonts/{Settings.Font}", (int)TCODFontFlags.LayoutAsciiInRow); TCODSystem.setFps(Settings.Fps); TCODConsole.initRoot(Settings.ScreenWidth, Settings.ScreenHeight, windowTitle, false, Settings.GetRendererType()); previousMouseData = TCODMouse.getStatus(); CurrentScene = initialScene; }
public void EnterSceneById(int sceneId) { EventDispatcher.Instance.Dispatch <bool>(EventConstant.SHOW_REQUEST_LOADING, false); if (mCurScene != null) { if (mSceneId == sceneId) { if (mCurScene.ReplaceScene() == false) { return; } } mPrevScene = mCurScene; // mPrevScene.BeforeExitScene(); GameTimerManager.Instance.ClearOnChangeScene(); // MsgManager.ClearAction(); } mSceneId = sceneId; switch (sceneId) { case mLoginSceneID: mCurScene = new LoginScene(0); //TODO LoginScene; break; case mMainSceneID: mCurScene = new MainScene(1); //TODO MainScene; break; case 10001: mCurScene = new PvpScene(sceneId); //TODO MainScene; break; default: break; } Debug.Log("sceneID:" + sceneId); // mCurScene.BeforeEnterScene(); this.BeforeEnterScene(sceneId); mSceneIDForLoader = mSceneId; }
public override void Update(BaseScene scene, FrameTick elapsedTime) { ActionTime += elapsedTime; int prevRadius = CurrentRadius; CurrentRadius = (int)ActionTime.FractionOf(Speed, GraphicsManager.MAX_FPS); if (CurrentRadius > Range) { CurrentRadius = Range; } int prevParticles = 0; int currentParticles = TotalParticles; if (Range > 0) { prevParticles = TotalParticles * prevRadius * prevRadius / Range / Range; currentParticles = TotalParticles * CurrentRadius * CurrentRadius / Range / Range; } for (int ii = prevParticles; ii < currentParticles; ii++) { List <int> openDirs = getOpenDirs(); int openIndex = openDirs[MathUtils.Rand.Next(openDirs.Count)]; Coverages[openIndex] = true; double angle = (openIndex + MathUtils.Rand.NextDouble()) * Math.PI / 4; int dist = CurrentRadius; if (dist >= 0 && dist <= Range) { Loc startDelta = new Loc((int)Math.Round(Math.Cos(angle) * dist), (int)Math.Round(Math.Sin(angle) * dist)); Loc randDiff = new Loc((int)((MathUtils.Rand.NextDouble() * 2 - 1) * SpeedDiff), 0); if (Anims.Count > 0) { IParticleEmittable chosenAnim = Anims[MathUtils.Rand.Next(Anims.Count)]; scene.Anims[(int)Layer].Add(chosenAnim.CreateParticle(Origin + startDelta, randDiff, Loc.Zero, StartHeight, HeightSpeed, 0, Dir)); } } } }
public int physGetLinksetType(UUID hostID, UUID scriptID) { int ret = -1; if (!Enabled) { return(ret); } // The part that is requesting the change. SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); if (requestingPart != null) { // The type is is always on the root of a linkset. SceneObjectGroup containingGroup = requestingPart.ParentGroup; SceneObjectPart rootPart = containingGroup.RootPart; if (rootPart != null) { PhysicsActor rootPhysActor = rootPart.PhysActor; if (rootPhysActor != null) { object[] parms2 = { rootPhysActor, null }; ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2)); } else { m_log.WarnFormat("{0} physGetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}", LogHeader, rootPart.Name, hostID); } } else { m_log.WarnFormat("{0} physGetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}", LogHeader, requestingPart.Name, hostID); } } else { m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); } return(ret); }
public override void Update(BaseScene scene, GameTime gameTime) { var rec = new Rectangle(this.Position.ToPoint(), this.Size.ToPoint()); var currentScissor = TruckerX.Game.GraphicsDevice.ScissorRectangle; TruckerX.Game.GraphicsDevice.ScissorRectangle = rec; base.Update(scene, gameTime); int spacing = 2; float scrollY = (this.scroll.Percentage * (totalScrollArea - (float)this.Size.Y)); float y = this.Position.Y - scrollY; for (int i = 0; i < Widgets.Count; i++) { var item = Widgets[i]; item.Position = new Vector2(this.Position.X, y); y += item.Size.Y + spacing; item.Update(scene, gameTime); } totalScrollArea = 0; if (Widgets.Count != 0) { totalScrollArea = Widgets.Count * ((int)Widgets[0].Size.Y + spacing); } if (totalScrollArea < this.Size.Y) { totalScrollArea = (int)this.Size.Y; } scroll.Size = new Vector2(30 * scene.GetRDMultiplier(), this.Size.Y); scroll.Position = new Vector2(this.Position.X + this.Size.X - scroll.Size.X, this.Position.Y); if (totalScrollArea > scroll.Size.Y) { scroll.ScrollbarTrackHeight = (int)(scroll.Size.Y * (scroll.Size.Y / totalScrollArea)); } else { scroll.ScrollbarTrackHeight = (int)scroll.Size.Y; } scroll.Update(scene, gameTime); TruckerX.Game.GraphicsDevice.ScissorRectangle = currentScissor; }
public override void Update(BaseScene scene, FrameTick elapsedTime) { base.Update(scene, elapsedTime); //a=EndLoc - StartLoc //b=(-a.y, a.x)/||a||*r*||a|| //b=(-a.y, a.x)*r //Va=t*a //Vb=4*b*t*(1-t) FrameTick midTime = ActionTime; Loc majorVector = EndLoc - StartLoc; Loc minorVector = new Loc(-majorVector.Y, majorVector.X); Loc majorDiff = majorVector * ActionTime.ToFrames() / MovingTime; double div = Math.Sqrt(majorDiff.DistSquared()); Loc minorDiff = 4 * minorVector * ActionTime.ToFrames() * (MovingTime - ActionTime.ToFrames()) / MovingTime / MovingTime; mapLoc = StartLoc + majorDiff + new Loc((int)(minorDiff.X * AxisRatio), (int)(minorDiff.Y * AxisRatio)); }
public override void Update(BaseScene scene, FrameTick elapsedTime) { CurrentBurstTime += elapsedTime; while (CurrentBurstTime >= Math.Max(1, BurstTime)) { CurrentBurstTime -= Math.Max(1, BurstTime); for (int ii = 0; ii < ParticlesPerBurst; ii++) { Loc startLoc = new Loc(MathUtils.Rand.Next(GraphicsManager.ScreenWidth), MathUtils.Rand.Next(GraphicsManager.ScreenHeight * 2)); int height = startLoc.Y; int time = (height - 1) * GraphicsManager.MAX_FPS / -HeightSpeed;// + 1; startLoc += scene.ViewRect.Start; WrappedRainAnim anim = new WrappedRainAnim(Anim, ResultAnim, Layer, time); anim.SetupEmitted(startLoc, new Loc(SpeedDiff, 0), Loc.Zero, height, HeightSpeed, 0, Dir); scene.Anims[(int)Layer].Add(anim); } } }
public override void OnEnterScene(BaseScene scene, uint instanceid) { if (mRes != null) { mBornEffectTime = mRes.born_effect_time; if (mRes.born_effect >= 0) { mBornEffectID = scene.CreateEffect(mRes.born_effect, new Vector3(mRes.born_effect_scale_x, mRes.born_effect_scale_y, mRes.born_effect_scale_z), GetPosition(), GetDirection(), null); } if (mRes.buffID != uint.MaxValue) { AddBornSkillEffect(new AttackerAttr(this), SkillEffectType.Buff, mRes.buffID); } } base.OnEnterScene(scene, instanceid); }
public void UpdateAxis(float realValue, bool isOnDrag, ETCBase.ControlType type, bool deltaTime = true) { // Auto link if (autoLinkTagPlayer && player == null || (player && !player.activeSelf)) { player = GameObject.FindGameObjectWithTag(autoTag); if (player) { directTransform = player.transform; } } // Auto stabilization if (isAutoStab && axisValue == 0 && _directTransform) { DoAutoStabilisation(); } if (invertedAxis) { realValue *= -1; } // Time push if (isValueOverTime && realValue != 0) { axisValue += overTimeStep * Mathf.Sign(realValue) * BaseScene.GetDtTime(); if (Mathf.Sign(axisValue) > 0) { axisValue = Mathf.Clamp(axisValue, 0, maxOverTimeValue); } else { axisValue = Mathf.Clamp(axisValue, -maxOverTimeValue, 0); } } // Axis value ComputAxisValue(realValue, type, isOnDrag, deltaTime); }
//自动判断是否要开启场景模糊效果 public static void AutoSceneBlur(string expect_name = "") { //打开镜头模糊 BaseScene baseScene = GameSceneManager.getInstance().SceneMono; if (baseScene == null) { return; } int length = showingWindows.Count; // for (int i = 0; i < length; i++) { // // if (expect_name != showingWindows[i]) // { // ControllerBase contro = GetControler(showingWindows[i]); // if (contro._needSceneHide) // { // return; // } // } // } for (int i = 0; i < length; i++) { if (expect_name != showingWindows[i]) { ControllerBase contro = GetControler(showingWindows[i]); if (contro._needSceneBlur) { //打开镜头模糊 baseScene.BlurOpen(); UtilTools.SetFPS(FPSLevel.OnlyUI); return; } } } //关闭镜头模糊 baseScene.BlurClose(); UtilTools.SetFPS(FPSLevel.Normal); UtilTools.HideScreenshot(); }
public void UnRegisterLevel(BaseScene t_regScene) { if (m_loadedScene.Contains(t_regScene)) { m_loadedScene.Remove(t_regScene); } if (m_loadedScene.Count > 0) { activeScene = m_loadedScene[m_loadedScene.Count - 1]; } else { activeScene = null; } }
private void InitScene() { switch (this.senceInfo.Type) { case 0: if (GameConst.GetInt32(110) == this.senceInfo.ID) { this.baseScene = new StartScene(this); } else if (this.senceInfo.SubType == 0) { if (this.worldScene == null) { this.worldScene = new WorldScene(this); } this.baseScene = this.worldScene; } else { if (this.defenseScene == null) { this.defenseScene = new DefenseScene(this); } this.baseScene = this.defenseScene; } break; case 1: if (this.trialScene == null) { this.trialScene = new TrialScene(this); } this.baseScene = this.trialScene; break; case 2: if (this.arenaScene == null) { this.arenaScene = new ArenaScene(this); } this.baseScene = this.arenaScene; break; case 3: if (this.worldBossScene == null) { this.worldBossScene = new WorldBossScene(this); } this.baseScene = this.worldBossScene; break; case 4: if (this.pillageScene == null) { this.pillageScene = new PillageScene(this); } this.baseScene = this.pillageScene; break; case 5: if (this.guildBossScene == null) { this.guildBossScene = new GuildBossScene(this); } this.baseScene = this.guildBossScene; break; case 6: if (this.senceInfo.SubType == 0 || this.senceInfo.SubType == 1) { this.baseScene = new KingRewardScene1(this); } else { this.baseScene = new KingRewardScene2(this); } break; case 7: if (this.memoryGearScene == null) { this.memoryGearScene = new MemoryGearScene(this); } this.baseScene = this.memoryGearScene; break; case 8: if (this.orePillageScene == null) { this.orePillageScene = new OrePillageScene(this); } this.baseScene = this.orePillageScene; break; case 9: if (this.guildPvpScene == null) { this.guildPvpScene = new GuildPvpScene(this); } this.baseScene = this.guildPvpScene; break; default: global::Debug.LogErrorFormat("senceInfo type error, type = {0}", new object[] { this.senceInfo.Type }); break; } if (this.baseScene == null) { global::Debug.LogError(new object[] { "baseScene is null" }); return; } this.baseScene.SetSceneInfo(this.senceInfo); this.baseScene.Init(); this.LoadRespawnInfo(); this.InitEnvironment(); }
public void ClearActor() { GameUIManager.mInstance.HUDTextMgr.Clear(); Globals.Instance.EffectSoundMgr.ClearCache(); this.invoker.Clear(); if (this.baseScene != null) { this.combatTime = this.baseScene.GetMaxCombatTimer() - this.baseScene.GetCombatTimer(); this.baseScene.Destroy(); this.baseScene = null; } this.senceInfo = null; this.actors.Clear(); this.LopetActor = null; this.RemoteLopetActor = null; for (int i = 0; i < 5; i++) { this.actors.Add(null); } this.assistPetID = 0; this.assistPetAttID = 0; this.combatLog = null; this.ServerData = null; }