protected override void onInit(SceneProcedure lastProcedure, string intent) { // 从待机流程和选择赛道流程跳转过来,正常显示布局 if (!lastProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SETTING)) { // 设置摄像机的变换 RoleDisplay roleDisplay = mSceneSystem.getScene <RoleDisplay>(GameDefine.ROLE_DISPLAY); GameCamera mainCamera = mCameraManager.getMainCamera(); if (!lastProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SELECT_TRACK)) { mainCamera.copyCamera(roleDisplay.mCameraPositionObject0); LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_BUTTOM_PROMPT, 9); } else { Transform cameraPos0 = roleDisplay.mCameraTransform0; ObjectTools.MOVE_OBJECT(mainCamera, mainCamera.getPosition(), cameraPos0.localPosition, 0.5f); ObjectTools.ROTATE_OBJECT(mainCamera, mainCamera.getRotation(), cameraPos0.localEulerAngles, 0.5f); } LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_SELECT_ROLE, 9); } // 从设置流程跳转过来,立即显示布局 else { LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_BUTTOM_PROMPT, 9); } LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_RETURN, 0); // 设置当前选中角色 CommandStartSceneSelectRole cmd = newCmd(out cmd); cmd.mIndex = mRoleSystem.getSelectedIndex(); cmd.mPlayAudio = false; pushCommand(cmd, mGameScene); }
public override void execute() { GameCamera camera = (mReceiver) as GameCamera; camera.linkTarget(mLinkerName, mTarget); if (mTarget != null) { // 停止正在进行的摄像机运动 ObjectTools.MOVE_OBJECT(camera, camera.getPosition()); ObjectTools.ROTATE_OBJECT(camera, camera.getRotation()); CameraLinker linker = camera.getComponent(mLinkerName) as CameraLinker; if (linker != null) { linker.setLookAtTarget(mLookAtTarget); linker.setLookAtOffset(mLookatOffset); // 不使用原来的相对位置,则设置新的相对位置 if (!mUseOriginRelative) { linker.setRelativePosition(mRelativePosition, mSwitchType, mUseLastSwitchSpeed, mSwitchSpeed); } if (mImmediately) { linker.applyRelativePosition(linker.getNormalRelativePosition()); } } else if (mLinkerName != "") { UnityUtility.logError("linker name is not empty, but can not find linker, name : " + mLinkerName); } } }
public override void NewTrafic(string Data) { // Data will be [TileType],[TileName],[XPos],[YPos],[ZPos],[InitData] DataSplit = Data.Split(','); Console.WriteLine("Recived PlaceTile"); ObjectTools.SpawnObject(DataSplit[2], DataSplit[3], DataSplit[4], DataSplit[1], DataSplit[0]); // Basically, it creates a new tile in that place. Variables.PhysicalObjects[DataSplit[1]].GiveData(DataSplit[5]); // Gives the tile in that spot the data it is intended to have at the molment. }
public void copyObjectTransform(GameObject obj) { Transform objTrans = obj.transform; ObjectTools.MOVE_OBJECT(this, objTrans.localPosition); ObjectTools.ROTATE_OBJECT(this, objTrans.localEulerAngles); ObjectTools.SCALE_OBJECT(this, objTrans.localScale); }
public override void enter(StateParam param) { mAnimation.CrossFade(GameDefine.ANIM_TURN_RIGHT); mAnimation.CrossFadeQueued(GameDefine.ANIM_RIDE); RoleDisplay scene = mSceneSystem.getScene <RoleDisplay>(GameDefine.ROLE_DISPLAY); ObjectTools.MOVE_OBJECT_EX(mPlayer, scene.mRolePosition0, scene.mRolePosition2, 1.0f, onMoveDone); }
public void InitializeScript() { //find tools posScript = GameObject.Find("PositionTool").GetComponent <PositionTool>(); scaleScript = GameObject.Find("ScaleTool").GetComponent <ScaleTool>(); transformTools = GameObject.Find("UIScripts").GetComponent <ObjectTools>(); state = false; scriptEnabled = true; }
protected IDataAdapter GetAdapter(string adpName) { ToCastToComponenet InstanceOfComponent; InstanceOfComponent = (ToCastToComponenet)ObjectTools.InstanceOfStringClass(this.AssemblyName, this.GenerateAdapterClass); IDataAdapter adp = (IDataAdapter)InstanceOfComponent.GetDataComponent(adpName); return(adp); }
protected IDbCommand GetCommand(string cmdName) { ToCastToComponenet InstanceOfComponent; InstanceOfComponent = (ToCastToComponenet)ObjectTools.InstanceOfStringClass(this.AssemblyName, this.GenerateAdapterClass); IDbCommand cmd = (IDbCommand)InstanceOfComponent.GetDataComponent(cmdName); return(cmd); }
protected override void onInit(SceneProcedure lastProcedure, string intent) { // 停止背景音乐 ObjectTools.PLAY_AUDIO_SCENE(); // 给所有角色添加比赛结束状态,如果已经有比赛结束状态的则不会再次添加 mRoleSystem.notifyAllPlayerFinish(); // 2秒后显示比赛结束的布局 // 开始后台异步加载角色展示场景 mSceneSystem.loadSceneAsync(GameDefine.ROLE_DISPLAY, false, onSceneLoaded); }
public GameObject[] GetAllSpawnPointGameObjects() { if (AccessType == TargetAccessType.TAG) { return(GameObject.FindGameObjectsWithTag(SpawnPointTag)); } else { return(ObjectTools.GetObjectsByName(SpawnPointName)); } }
// 通知开始销毁 public override void notifyDestroy() { base.notifyDestroy(); // 停止追踪,播放爆炸特效并隐藏导弹模型 ObjectTools.TRACK_TARGET(this, 10.0f, null); UnityUtility.getGameObject(mObject, mExplodeParticleName, true).SetActive(true); UnityUtility.getGameObject(mObject, mExplodeParticleName1, true).SetActive(true); UnityUtility.getGameObject(mObject, mMissileModelName, true).SetActive(false); // 0.7秒后销毁物体 mItemManager.destroyItemDelay(this, 0.7f); }
private void Start() { transformTools = GameObject.Find("UIScripts").GetComponent <ObjectTools>(); List <string> creatableobjects = new List <string>(); foreach (Transform trans in GameObject.Find("CreatableObjects").transform) { creatableobjects.Add(trans.gameObject.name); } creatableObjectsDropDown.ClearOptions(); creatableObjectsDropDown.AddOptions(creatableobjects); creatableObjectsDropDown.value = 0; }
private void Start() { //initialize scripts for objects MoveObject[] moveableObjects = FindObjectsOfType <MoveObject>(); //save = GetComponent<SaveManager>(); Debug.Log("Moveable Objects: " + moveableObjects.Length); foreach (MoveObject move in moveableObjects) { move.enabled = true; move.InitializeScript(); } //get objects posScript = GameObject.Find("PositionTool").GetComponent <PositionTool>(); scaleScript = GameObject.Find("ScaleTool").GetComponent <ScaleTool>(); tools = GameObject.Find("UIScripts").GetComponent <ObjectTools>(); }
public override void enter(StateParam param) { // 隐藏静态拖尾,并显示动态拖 mPlayer.activeTrail(false); // 将玩家设置到起点位置 GameTrackBase curTrack = mRaceSystem.getCurGameTrack(); ObjectTools.MOVE_OBJECT(mPlayer, curTrack.mStartPointList[mPlayer.getCharacterData().mStartIndex]); // 添加休闲状态 CommandCharacterStop cmdStop = newCmd(out cmdStop); cmdStop.mFadeStop = false; cmdStop.mFadeStanding = false; pushCommand(cmdStop, mPlayer); // 使角色朝向前方 Vector3 point0 = mWayPointManager.getPoint(0); Vector3 point1 = mWayPointManager.getPoint(1); float dir = MathUtility.getAngleFromVector(point1 - point0) * Mathf.Rad2Deg; ObjectTools.ROTATE_OBJECT(mPlayer, new Vector3(0.0f, dir, 0.0f)); // 启用自行车物理组件,启用硬件速度组件,里程计算组件,手动更新角色位置后再挂接摄像机 mPlayer.activeFirstComponent <CharacterTrackMileage>(); mPlayer.activeFirstComponent <CharacterBikePhysics>(); mPlayer.activeFirstComponent <CharacterSpeedHardware>(); mPlayer.getFirstComponent <CharacterBikePhysics>().correctTransform(); if (mPlayer.isType(CHARACTER_TYPE.CT_AI)) { mPlayer.activeFirstComponent <CharacterControllerAI>(); } // 只有主角才挂摄像机 if (mPlayer.isType(CHARACTER_TYPE.CT_MYSELF)) { CommandCameraLinkTarget cmd = newCmd(out cmd); cmd.mTarget = mPlayer; cmd.mLinkerName = "SmoothFollow"; cmd.mLookatOffset = GameDefine.CAMERA_LOOKAT_OFFSET; cmd.mImmediately = true; cmd.setRelativePosition(GameDefine.CAMERA_RELATIVE); pushCommand(cmd, mCameraManager.getMainCamera()); CameraLinkerSmoothFollow linkerSmoothFollow = mCameraManager.getMainCamera().getComponent("SmoothFollow") as CameraLinkerSmoothFollow; linkerSmoothFollow.setCheckGroundLayer(GameUtility.mGroundLayer); } }
protected override void onInit(SceneProcedure lastProcedure, string intent) { if (lastProcedure.isThisOrParent(PROCEDURE_TYPE.PT_START_SETTING)) { LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_BUTTOM_PROMPT, 0); } LayoutTools.LOAD_NGUI_SHOW(LAYOUT_TYPE.LT_SELECT_TRACK, 0); RoleDisplay roleDisplay = mSceneSystem.getScene <RoleDisplay>(GameDefine.ROLE_DISPLAY); Transform cameraPos1 = roleDisplay.mCameraTransform1; GameCamera mainCamera = mCameraManager.getMainCamera(); ObjectTools.MOVE_OBJECT(mainCamera, mainCamera.getPosition(), cameraPos1.localPosition, 0.5f); ObjectTools.ROTATE_OBJECT(mainCamera, mainCamera.getRotation(), cameraPos1.localEulerAngles, 0.5f); CommandStartSceneSelectTrack cmdTrack = newCmd(out cmdTrack); cmdTrack.mTrack = mRaceSystem.getTrackIndex(); cmdTrack.mPlayAudio = false; pushCommand(cmdTrack, mGameScene); }
public override void init(ItemParamBase param) { base.init(param); MissileParam missileParam = param as MissileParam; // 创建导弹模型并添加导弹脚本 createObject(GameDefine.R_SCENE_ITEM_PREFAB_PATH + GameDefine.MISSILE, missileParam.mPosition); UnityUtility.getGameObject(mObject, mExplodeParticleName, true).SetActive(false); UnityUtility.getGameObject(mObject, mExplodeParticleName1, true).SetActive(false); UnityUtility.getGameObject(mObject, mMissileModelName, true).SetActive(true); mMissileComponent = mObject.GetComponent <MissileObject>(); if (mMissileComponent == null) { mMissileComponent = mObject.AddComponent <MissileObject>(); } mMissileComponent.setItem(this); ObjectTools.TRACK_TARGET(this, GameDefine.MISSILE_SPEED, missileParam.mTarget, Vector3.up); mTarget = missileParam.mTarget; }
public override void enter(StateParam param) { mCharacterManager.activeCharacter(mPlayer, true); RoleDisplay scene = mSceneSystem.getScene <RoleDisplay>(GameDefine.ROLE_DISPLAY); ObjectTools.MOVE_OBJECT_EX(mPlayer, scene.mRolePosition1, scene.mRolePosition0, 1.0f, onMoveDone); mPlayer.resetRotation(); // 设置静止状态拖尾,播放骑行动作 mPlayer.activeTrail(true); AnimationOdds anim = generateAnimation(); mAnimation.Play(anim.mAnimName); mAnimation[anim.mAnimName].speed = 1.5f; mAnimation.PlayQueued(anim.mNextAnim); mAnimation[anim.mNextAnim + GameDefine.QUEUE_SUFFIX].speed = 1.5f; mPlayer.getSelectAnimation().Clear(); mPlayer.getSelectAnimation().Add(anim.mAnimName); mPlayer.getSelectAnimation().Add(anim.mNextAnim); }
/// <summary> /// Uses Reflection to get ALL of the <see cref="Cookie">Cookies</see> where <see cref="Cookie.Domain"/> /// contains part of the specified string. Will return cookies for any subdomain, as well as dotted-prefix cookies. /// </summary> /// <param name="cookieContainer">The <see cref="CookieContainer"/> to extract the <see cref="Cookie">Cookies</see> from.</param> /// <param name="domain">The string that contains part of the domain you want to extract cookies for.</param> /// <returns></returns> public static IEnumerable <Cookie> GetCookies(this CookieContainer cookieContainer, string domain) { var domainTableFieldName = "m_domainTable"; var bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; var domainTable = ObjectTools.GetFieldValue <dynamic>(cookieContainer, domainTableFieldName, bindFlags); if (domainTable is null) { throw new ArgumentNullException($"Field {domainTableFieldName} is not existing."); } foreach (var entry in domainTable) { string key = ObjectTools.GetPropertyValue <string>(entry, "Key"); if (key.Contains(domain)) { var value = ObjectTools.GetPropertyValue <dynamic>(entry, "Value"); var internalList = ObjectTools.GetFieldValue <SortedList <string, CookieCollection> >(value, "_list", bindFlags); foreach (var li in internalList) { if (li is null) { continue; } foreach (Cookie?cookie in li.Value) { if (cookie is null) { continue; } yield return(cookie); } } } } }
public void _initThreads() { //ThreadsCollection.Add("Minutly", new Minutly()); //ThreadsCollection.Add("Hourly", new Hourly()); //ThreadsCollection.Add("Daily", new Daily()); //ThreadsCollection.Add("Weekly", new Weekly()); //ThreadsCollection.Add("Monthly", new Monthly()); //ThreadsCollection.Add("Yearly", new Yearly()); DataSet threadingDs = XmlManager.GetDataSet(CTE.Content.Threadings); if (threadingDs != null) { DataTable threadTable = threadingDs.Tables["Threadings"]; if (threadTable != null) { foreach (DataRow dr in threadTable.Rows) { string key = dr["Description"].ToString(); if (ThreadsCollection.Keys.Contains(key)) { continue; } var thread = (ThreadingBase)ObjectTools.InstanceOfStringClass((string)dr["AssemblyName"], (string)dr["ClassName"]); thread.Repeat = (RepeatPattern)Enum.Parse(typeof(RepeatPattern), dr["Pattern"].ToString()); thread.StartDate = (DateTime)dr["StartDate"]; thread.Key = key; thread.AddToGlobalThreads(); ThreadsCollection.Add(key, thread); } } } }
public static void PLAY_AUDIO_OBJECT(MovableObject obj, string sound, bool loop) { ObjectTools.PLAY_AUDIO_OBJECT(obj, sound, loop, mGameSetting.getCurVolume()); }
//------------------------------------------------------------------------------------------------------------------ // 物体音效 #region 播放物体音效 public static void PLAY_AUDIO_OBJECT(MovableObject obj, SOUND_DEFINE sound) { ObjectTools.PLAY_AUDIO_OBJECT(obj, sound, false, mGameSetting.getCurVolume()); }
public static void PLAY_AUDIO_SCENE(string sound, bool loop) { ObjectTools.PLAY_AUDIO_SCENE(sound, loop, mGameSetting.getCurVolume()); }
public static void PLAY_AUDIO_SCENE(string sound) { ObjectTools.PLAY_AUDIO_SCENE(sound, false, mGameSetting.getCurVolume()); }
static void Init() { ObjectTools window = (ObjectTools)EditorWindow.GetWindow(typeof(ObjectTools)); }
protected override void onExit(SceneProcedure nextProcedure) { LayoutTools.HIDE_LAYOUT(LAYOUT_TYPE.LT_CONFIRM_SELECTION); // 停止背景音乐 ObjectTools.PLAY_AUDIO_SCENE(); }