/// <summary> /// 保存gamemanager,开始init /// </summary> /// <param name="ins"></param> public void StartInitResources(GameManager ins) { mGameManager = ins; _pkgConfig = UtilCommon.AddComponent <PkgConfig>(mGameManager.gameObject) as PkgConfig; _pkgConfig.SetCallback(InitVersionContrl); _pkgConfig.OnStartDownload(); }
static int AddComponent(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(Type))) { GameObject arg0 = LuaScriptMgr.GetUnityObject <GameObject>(L, 1); Type arg1 = LuaScriptMgr.GetTypeObject(L, 2); Component o = UtilCommon.AddComponent(arg0, arg1); LuaScriptMgr.Push(L, o); return(1); } else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(string))) { GameObject arg0 = LuaScriptMgr.GetUnityObject <GameObject>(L, 1); string arg1 = LuaScriptMgr.GetString(L, 2); Component o = UtilCommon.AddComponent(arg0, arg1); LuaScriptMgr.Push(L, o); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: UtilCommon.AddComponent"); } return(0); }
/// <summary> /// 初始化 /// </summary> public virtual void Init(GameManager ins) { mGameManager = ins; _isStartUpdate = false; if (mGameManager) { _pkgConfig = UtilCommon.AddComponent <PkgConfig>(mGameManager.gameObject) as PkgConfig; _pkgVersion = UtilCommon.AddComponent <PkgVersion>(mGameManager.gameObject) as PkgVersion; _pkgBundle = UtilCommon.AddComponent <PkgBundle>(mGameManager.gameObject) as PkgBundle; _pkgLua = UtilCommon.AddComponent <PkgLua>(mGameManager.gameObject) as PkgLua; _pkgFileList = UtilCommon.AddComponent <PkgFileList>(mGameManager.gameObject) as PkgFileList; } }
private void InitInputRoot() { // 添加触摸输入组件 inputManager = UtilCommon.AddComponent <InputRoot>(gameObject) as InputRoot; inputManager.AddFingerDownMethod(this.OnFingerDownMethod); inputManager.AddFingerHoverMethod(this.OnFingerHoverMethod); inputManager.AddFingerMoveMethod(this.OnFingerMoveMethod); inputManager.AddFingerStationaryMethod(this.OnFingerStationaryMethod); inputManager.AddFingerUpMethod(this.OnFingerUpMethod); inputManager.AddFirstFingerDragMethod(this.OnFirstFingerDragMethod); inputManager.AddLongPressMethod(this.OnLongPressMethod); inputManager.AddTapMethod(this.OnTapMethod); inputManager.AddSwipeMethod(this.OnSwipeMethod); inputManager.AddPinchMethod(this.OnPinchMethod); inputManager.AddTwistMethod(this.OnTwistMethod); }
/// <summary> /// 获得控制方案 /// </summary> /// <param name="controltype"></param> protected void InitControlByType(VersionControlType controltype) { switch (controltype) { case VersionControlType.kApp: _versionControl = UtilCommon.AddComponent <VersionControlApp>(mGameManager.gameObject) as VersionControlApp; break; case VersionControlType.kDev: _versionControl = UtilCommon.AddComponent <VersionControlDev>(mGameManager.gameObject) as VersionControlDev; break; case VersionControlType.kArt: _versionControl = UtilCommon.AddComponent <VersionControlArt>(mGameManager.gameObject) as VersionControlArt; break; default: _versionControl = UtilCommon.AddComponent <VersionControlApp>(mGameManager.gameObject) as VersionControlApp; break; } }
void Init() { Screen.sleepTimeout = SleepTimeout.NeverSleep; Application.targetFrameRate = Const.GameFrameRate; gameObject.name = "GameManager"; gameObject.tag = "GameManager"; DontDestroyOnLoad(gameObject); //防止销毁自己 //DontDestroyOnLoad(Camera.main); InitDataPath(); InitInputRoot(); //Util.Add<PanelManager>(gameObject); //Util.Add<MusicManager>(gameObject); // Util.Add<TimerManager>(gameObject); UtilCommon.AddComponent <SocketClient>(gameObject); UtilCommon.AddComponent <NetworkManager>(gameObject); UtilCommon.AddComponent <ResourceManager>(gameObject); UtilCommon.AddComponent <AudioManager>(gameObject); }
void Init() { Screen.sleepTimeout = SleepTimeout.NeverSleep; Application.targetFrameRate = Const.GameFrameRate; gameObject.name = "GameManager"; gameObject.tag = "GameManager"; DontDestroyOnLoad(gameObject); //防止销毁自己 InitDataPath(); //InitInputRoot(); UtilCommon.AddComponent <SocketClient>(gameObject); UtilCommon.AddComponent <NetworkManager>(gameObject); UtilCommon.AddComponent <ResourceManager>(gameObject); UtilCommon.AddComponent <AudioManager>(gameObject); UtilCommon.AddComponent <IOManager>(gameObject); UtilCommon.AddComponent <GameMode>(gameObject); UtilCommon.AddComponent <PlayerManager>(gameObject); UtilCommon.AddComponent <CameraManager>(gameObject); UtilCommon.AddComponent <NonStopTime>(gameObject); UtilCommon.AddComponent <SafeNet>(gameObject); }