void GameStart() { ResMng.InitResPath(strResource); InvokeRepeating("CheckCondition", 5.0f, 5.0f); InvokeRepeating("CleanRes", 60.0f, 60.0f); bShowPercent = false; Global.ShowLoadingEnd(); }
private void Awake() { Ins = this; Log = new Log(); ActiveState = new List <PersistState>(); GameOverlay = new GameOverlayDialogState(); FightState = new FightState(); ReplayState = new ReplayState(); NickNameDialogState = new NickNameDialogState(); BattleStatusDialogState = new BattleStatusDialogState(); PlayerDialogState = new PlayerDialogState(); ChatDialogState = new ChatDialogState(); PsdEditDialogState = new PsdEditDialogState(); RoomChatDialogState = new RoomChatDialogState(); LoadingEx = new LoadingEXDialogState(); ItemInfoDialogState = new ItemInfoDialogState(); GunShootDialogStatus = new GunShootDialogStatus(); //面板管理器. DialogStateManager = new MainDialogStateManager(); //顺序排队弹出框. PopupStateManager = new MainPopupStateManager(); //各类游戏数据. GameStateMgr = new GameStateMgr(); UpdateHelper = new UpdateHelper(); AppInfo = new AppInfo(); CombatData = new CombatData(); GameNotice = new GameNotice(); MeteorManager = new MeteorManager(); ScriptMng = new ScriptMng(); SFXLoader = new SFXLoader(); ActionInterrupt = new ActionInterrupt(); BuffMng = new BuffMng(); EventBus = new EventBus(); NetWorkBattle = new NetWorkBattle(); SceneMng = new SceneMng(); FrameSync = new FrameSync(); MeteorBehaviour = new MeteorBehaviour(); DropMng = new DropMng(); //原版相关资源的加载器. MenuResLoader = new MenuResLoader(); SkcLoader = new SkcLoader(); BncLoader = new BncLoader(); FMCLoader = new FMCLoader(); GMBLoader = new GMBLoader(); GMCLoader = new GMCLoader(); DesLoader = new DesLoader(); FMCPoseLoader = new FMCPoseLoader(); DataMgr = new DataMgr(); SfxMeshGenerator = new SfxMeshGenerator(); RoomMng = new RoomMng(); SoundManager = new SoundManager(); ResMng = new ResMng(); DlcMng = new DlcMng(); DontDestroyOnLoad(gameObject); Log.WriteError(string.Format("GameStart AppVersion:{0}", Main.Ins.AppInfo.AppVersion())); }
void CheckCondition() { lock (downloadDone) { foreach (var str in downloadDone) { ResMng.AddDownloadDoneRes(str); } downloadDone.Clear(); } if (checkList.Count != 0) { Debug.Log("add"); } if (checkList.Count != 0) { HttpClient.Condition del = null; List <ReferenceNode> download = null; lock (checkList) { foreach (var check in checkList) { ReferenceNode root = ReferenceNode.GetExistNode(check.root.strResources); if (root != null) { ResMng.CollectDownloadRes(check.root.strResources, ref download, ref root); if (download.Count == 0) { Log.LogInfo("download.count == 0 can load res"); del = check; } else { Log.LogInfo("load " + check.strResource + "need extra res" + download.Count); } } else { del = check; break; } } if (del != null) { Log.LogInfo("remove condition:" + del + "resource" + del.strResource); checkList.Remove(del); if (download != null && download.Count == 0) { Log.LogInfo("call callback to load resources" + del.strResource); del.cb(del.param); } } } } }
void OnPrevWeapon() { weaponIdx -= 1; if (weaponIdx < 0) { weaponIdx = 11; } weaponImg.material = ResMng.Load(string.Format("Weapon_{0}", weaponIdx)) as Material; }
void OnNextWeapon() { weaponIdx += 1; if (weaponIdx >= 12) { weaponIdx = 0; } weaponImg.material = ResMng.Load(string.Format("Weapon_{0}", weaponIdx)) as Material; }
public static void Init(Vector3 spawn, Vector3 forw, InventoryItem weapon, AttackDes att, MeteorUnit owner) { GameObject dartObj = GameObject.Instantiate(ResMng.LoadPrefab("DartLoader"), spawn, Quaternion.identity, null) as GameObject; dartObj.layer = LayerMask.NameToLayer("Flight"); DartLoader dart = dartObj.GetComponent <DartLoader>(); dart.LoadAttack(weapon, forw, att, owner); }
void OnNextHero() { heroIdx += 1; if (heroIdx >= Main.Ins.DataMgr.GetDatasArray <ModelDatas.ModelDatas>().Count) { heroIdx = 0; } heroImg.material = ResMng.Load(string.Format("Hero{0}", heroIdx)) as Material; }
void OnPrevHero() { heroIdx -= 1; if (heroIdx < 0) { heroIdx = Main.Ins.DataMgr.GetDatasArray <ModelDatas.ModelDatas>().Count - 1; } heroImg.material = ResMng.Load(string.Format("Hero{0}", heroIdx)) as Material; }
void Init() { inputChat = Control("ChatText", WndObject).GetComponent <InputField>(); Control("SendShortMsg", WndObject).GetComponent <Button>().onClick.AddListener(() => { if (Main.Ins.CombatData.GLevelMode == LevelMode.MultiplyPlayer) { string chatMessage = inputChat.text; if (string.IsNullOrEmpty(inputChat.text)) { U3D.PopupTip("无法发送内容为空的语句"); return; } Common.SendChatMessage(chatMessage); } }); Control("CloseQuickMsg", WndObject).GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); }); Control("CloseShortMsg", WndObject).GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); }); Control("CloseAudioMsg", WndObject).GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); }); if (jsData == null) { TextAsset text = ResMng.Load("MsgTable") as TextAsset; jsData = LitJson.JsonMapper.ToObject(text.text); } for (int i = 0; i < jsData["Msg"].Count; i++) { string strQuick = jsData["Msg"][i].ToString(); Control(i.ToString(), WndObject).GetComponentInChildren <Text>().text = strQuick; int j = i; Control(i.ToString(), WndObject).GetComponent <Button>().onClick.AddListener(() => { SendQuickMsg(j); }); } Control("Record", WndObject).GetComponent <Button>().onClick.AddListener(() => { Record(); }); Control("SendAudio", WndObject).GetComponent <Button>().onClick.AddListener(() => { SendAudioMsg(); }); GameObject objListen = Control("Listen", WndObject); source = objListen.GetComponent <AudioSource>(); Listen = objListen.GetComponent <Button>(); Listen.onClick.AddListener(() => { if (MicChat.clip != null) { source.PlayOneShot(MicChat.clip); } Debug.Log("play clip"); }); CountDown = Control("CountDown", WndObject); }
public override void OnRefresh(int message, object param) { switch (message) { case ADD: ServerInfo info = param as ServerInfo; GameObject prefab = ResMng.LoadPrefab("SelectListItem") as GameObject; InsertServerItem(info, prefab); break; } }
void Init() { ServerListRoot = Control("ServerListRoot"); GameObject prefab = ResMng.LoadPrefab("SelectListItem") as GameObject; for (int i = 0; i < serverList.Count; i++) { GameObject.Destroy(serverList[i]); } serverList.Clear(); for (int i = 0; i < Main.Ins.GameStateMgr.gameStatus.ServerList.Count; i++) { InsertServerItem(Main.Ins.GameStateMgr.gameStatus.ServerList[i], prefab); } GameObject defaultServer = Control("SelectListItem"); Text text = Control("Text", defaultServer).GetComponent <Text>(); Control("Delete").GetComponent <Button>().onClick.AddListener(() => { //不能删除默认 if (selectServer != null) { int selectServerId = Main.Ins.GameStateMgr.gameStatus.ServerList.IndexOf(selectServer); if (selectServerId != -1) { GameObject.Destroy(serverList[selectServerId]); serverList.RemoveAt(selectServerId); Main.Ins.CombatData.OnServiceChanged(-1, Main.Ins.GameStateMgr.gameStatus.ServerList[selectServerId]); Main.Ins.GameStateMgr.gameStatus.ServerList.RemoveAt(selectServerId); } if (selectServerId >= serverList.Count) { selectServerId = 0; } selectServer = Main.Ins.GameStateMgr.gameStatus.ServerList[selectServerId]; selectedBtn = null; } }); Control("Close").GetComponent <Button>().onClick.AddListener(() => { OnPreviousPress(); }); Control("AddHost").GetComponent <Button>().onClick.AddListener(() => { Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.HostEditDialogState); }); text.text = Main.Ins.CombatData.Server.ServerName + string.Format(":{0}", Main.Ins.CombatData.Server.ServerPort); }
public void DownLoadVersion(VersionItem ver, Main loader) { updateVersion = new UpdateVersion(); updateVersion.Version = ver.strVersion; updateVersion.VersionMax = ver.strVersionMax; updateVersion.File = new UpdateFile(); updateVersion.File.bHashChecked = false; updateVersion.File.Loadbytes = 0; updateVersion.File.strFile = ver.zip.fileName; if (File.Exists(ResMng.GetUpdateTmpPath() + "/" + ver.zip.fileName)) { File.Delete(ResMng.GetUpdateTmpPath() + "/" + ver.zip.fileName); } updateVersion.File.strLocalPath = ResMng.GetUpdateTmpPath() + "/" + ver.zip.fileName; updateVersion.File.Totalbytes = ver.zip.size; updateVersion.File.strMd5 = ver.zip.Md5; loader.StartDownLoad(updateVersion); }
IEnumerator LoadLevelAsync() { int displayProgress = 0; int toProgress = 0; yield return(0); LevelDatas.LevelDatas lev = Main.Ins.CombatData.GLevelItem; ResMng.LoadScene(lev.Scene); mAsync = SceneManager.LoadSceneAsync(lev.Scene); mAsync.allowSceneActivation = false; while (mAsync.progress < 0.9f) { toProgress = (int)mAsync.progress * 100; while (displayProgress < toProgress) { ++displayProgress; if (LoadingDialogState.Exist) { LoadingDialogState.Instance.UpdateProgress(displayProgress / 100.0f); } yield return(0); } yield return(0); } toProgress = 100; while (displayProgress < toProgress) { ++displayProgress; if (LoadingDialogState.Exist) { LoadingDialogState.Instance.UpdateProgress(displayProgress / 100.0f); } yield return(0); } mAsync.allowSceneActivation = true; while (!mAsync.isDone) { yield return(0); } OnLoadFinishedEx(lev); Destroy(this); }
void Init() { heroImg = Control("Image").GetComponent <Image>(); heroImg.material = ResMng.Load("Hero0") as Material; Control("Next").GetComponent <Button>().onClick.AddListener(() => { OnNextHero(); U3D.PlayBtnAudio(); }); Control("Prev").GetComponent <Button>().onClick.AddListener(() => { OnPrevHero(); U3D.PlayBtnAudio(); }); Control("Select").GetComponent <UIButtonExtended>().onClick.AddListener(() => { OnSelectHero(); U3D.PlayBtnAudio(); }); }
//单个节点 static AssetBundle LoadResNodeInternal(ReferenceNode node) { if (node == null) { return(null); } if (Bundle.ContainsKey(node.strResources)) { return(Bundle[node.strResources]); } if (File.Exists(ResMng.GetResPath() + "/" + node.strResources)) { FileStream fs = new FileStream(ResMng.GetResPath() + "/" + node.strResources, FileMode.Open, FileAccess.Read); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); fs.Close(); AssetBundle ab = AssetBundle.LoadFromMemory(buffer); Bundle.Add(node.strResources, ab); return(ab); } return(null); }
void InsertServerItem(ServerInfo svr, int i) { GameObject btn = GameObject.Instantiate(ResMng.Load("ButtonNormal")) as GameObject; btn.transform.SetParent(serverRoot.transform); btn.transform.localScale = Vector3.one; btn.transform.localPosition = Vector3.zero; btn.transform.localRotation = Quaternion.identity; btn.GetComponent <Button>().onClick.AddListener(() => { if (Main.Ins.CombatData.Server == Main.Ins.CombatData.Servers[i]) { TcpClientProxy.CheckNeedReConnect(); return; } TcpClientProxy.Exit(); ClearRooms(); Main.Ins.CombatData.Server = svr; TcpClientProxy.ReStart(); }); btn.GetComponentInChildren <Text>().text = svr.ServerName; }
void InsertDlc(Chapter item) { if (prefabPluginWnd == null) { prefabPluginWnd = ResMng.Load("PluginWnd") as GameObject; } GameObject insert = GameObject.Instantiate(prefabPluginWnd); insert.transform.SetParent(PluginRoot.transform); insert.transform.localPosition = Vector3.zero; insert.transform.localScale = Vector3.one; insert.transform.localRotation = Quaternion.identity; PluginCtrl ctrl = insert.GetComponent <PluginCtrl>(); if (ctrl != null) { ctrl.AttachDlc(item); if (!Main.Ins.GameStateMgr.gameStatus.IsDlcInstalled(item)) { Main.Ins.DlcMng.AddPreviewTask(ctrl); } } pluginList.Add(ctrl); }
void Init() { weaponSubType = EquipWeaponType.Sword; if (CameraForWeapon == null) { CameraForWeapon = GameObject.Instantiate(ResMng.LoadPrefab("CameraForWeapon")) as GameObject; CameraForWeapon.Identity(null); WeaponModelParent = Control("WeaponParent", CameraForWeapon); wload = WeaponModelParent.GetComponent <WeaponLoader>(); wload.Init(); } WeaponRoot = Control("WeaponRoot"); Control("Equip").GetComponent <Button>().onClick.AddListener(() => { ChangeWeaponCode(); }); Control("Close").GetComponent <Button>().onClick.AddListener(OnBackPress); for (int i = 0; i < 12; i++) { string control = string.Format("Tab{0}", i); Control(control).GetComponent <UITab>().onValueChanged.AddListener(ChangeWeaponType); } if (load == null) { load = Main.Ins.StartCoroutine(AddWeapon()); } }
void Init() { Control("Return").GetComponent <Button>().onClick.AddListener(() => { Main.Ins.GameStateMgr.SaveState(); Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.MainMenuState); }); Control("DeleteState").GetComponent <Button>().onClick.AddListener(() => { Main.Ins.GameStateMgr.ResetState(); Init(); }); Control("ChangeLog").GetComponent <Text>().text = ResMng.LoadTextAsset("ChangeLog").text; Control("AppVerText").GetComponent <Text>().text = Main.Ins.AppInfo.AppVersion(); Control("MeteorVerText").GetComponent <Text>().text = Main.Ins.AppInfo.MeteorVersion; Control("Nick").GetComponentInChildren <Text>().text = Main.Ins.CombatData.Logined ? Main.Ins.GameStateMgr.gameStatus.NickName:"未登录"; Control("Nick").GetComponent <Button>().onClick.AddListener( () => { if (Main.Ins.CombatData.Logined) { Main.Ins.EnterState(Main.Ins.NickNameDialogState); } else { } } ); Toggle highPerfor = Control("HighPerformance").GetComponent <Toggle>(); highPerfor.isOn = Main.Ins.GameStateMgr.gameStatus.TargetFrame == 60; highPerfor.onValueChanged.AddListener(OnChangePerformance); Toggle High = Control("High").GetComponent <Toggle>(); Toggle Medium = Control("Medium").GetComponent <Toggle>(); Toggle Low = Control("Low").GetComponent <Toggle>(); High.isOn = Main.Ins.GameStateMgr.gameStatus.Quality == 0; Medium.isOn = Main.Ins.GameStateMgr.gameStatus.Quality == 1; Low.isOn = Main.Ins.GameStateMgr.gameStatus.Quality == 2; High.onValueChanged.AddListener((bool selected) => { if (selected) { Main.Ins.GameStateMgr.gameStatus.Quality = 0; } }); Medium.onValueChanged.AddListener((bool selected) => { if (selected) { Main.Ins.GameStateMgr.gameStatus.Quality = 1; } }); Low.onValueChanged.AddListener((bool selected) => { if (selected) { Main.Ins.GameStateMgr.gameStatus.Quality = 2; } }); Toggle ShowTargetBlood = Control("ShowTargetBlood").GetComponent <Toggle>(); ShowTargetBlood.isOn = Main.Ins.GameStateMgr.gameStatus.ShowBlood; ShowTargetBlood.onValueChanged.AddListener((bool selected) => { Main.Ins.GameStateMgr.gameStatus.ShowBlood = selected; }); Toggle ShowFPS = Control("ShowFPS").GetComponent <Toggle>(); ShowFPS.isOn = Main.Ins.GameStateMgr.gameStatus.ShowFPS; ShowFPS.onValueChanged.AddListener((bool selected) => { Main.Ins.GameStateMgr.gameStatus.ShowFPS = selected; Main.Ins.ShowFps(selected); }); Toggle ShowSysMenu2 = Control("ShowSysMenu2").GetComponent <Toggle>(); ShowSysMenu2.isOn = Main.Ins.GameStateMgr.gameStatus.ShowSysMenu2; ShowSysMenu2.onValueChanged.AddListener((bool selected) => { Main.Ins.GameStateMgr.gameStatus.ShowSysMenu2 = selected; }); if (Main.Ins != null) { Control("BGMSlider").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.MusicVolume; Control("EffectSlider").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.SoundVolume; Control("HSliderBar").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.AxisSensitivity.x; Control("VSliderBar").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.AxisSensitivity.y; } Control("BGMSlider").GetComponent <Slider>().onValueChanged.AddListener(OnMusicVolumeChange); Control("EffectSlider").GetComponent <Slider>().onValueChanged.AddListener(OnEffectVolumeChange); Control("HSliderBar").GetComponent <Slider>().onValueChanged.AddListener(OnXSensitivityChange); Control("VSliderBar").GetComponent <Slider>().onValueChanged.AddListener(OnYSensitivityChange); Control("SetJoyPosition").GetComponent <Button>().onClick.AddListener(OnSetUIPosition); //显示战斗界面的调试按钮 Toggle toggleDebug = Control("EnableSFX").GetComponent <Toggle>(); toggleDebug.isOn = Main.Ins.GameStateMgr.gameStatus.EnableDebugSFX; toggleDebug.onValueChanged.AddListener(OnEnableDebugSFX); //显示战斗界面的调试按钮 Toggle toggleRobot = Control("EnableRobot").GetComponent <Toggle>(); toggleRobot.isOn = Main.Ins.GameStateMgr.gameStatus.EnableDebugRobot; toggleRobot.onValueChanged.AddListener(OnEnableDebugRobot); //显示武器挑选按钮 Toggle toggleEnableFunc = Control("EnableWeaponChoose").GetComponent <Toggle>(); toggleEnableFunc.isOn = Main.Ins.GameStateMgr.gameStatus.EnableWeaponChoose; toggleEnableFunc.onValueChanged.AddListener(OnEnableWeaponChoose); //无限气 Toggle toggleEnableInfiniteAngry = Control("EnableInfiniteAngry").GetComponent <Toggle>(); toggleEnableInfiniteAngry.isOn = Main.Ins.GameStateMgr.gameStatus.EnableInfiniteAngry; toggleEnableInfiniteAngry.onValueChanged.AddListener(OnEnableInfiniteAngry); //无锁定 Toggle toggleDisableLock = Control("CameraLock").GetComponent <Toggle>(); toggleDisableLock.isOn = Main.Ins.GameStateMgr.gameStatus.AutoLock; toggleDisableLock.onValueChanged.AddListener(OnDisableLock); Toggle toggleEnableGodMode = Control("EnableGodMode").GetComponent <Toggle>(); toggleEnableGodMode.isOn = Main.Ins.GameStateMgr.gameStatus.EnableGodMode; toggleEnableGodMode.onValueChanged.AddListener(OnEnableGodMode); Toggle toggleEnableUndead = Control("EnableUnDead").GetComponent <Toggle>(); toggleEnableUndead.isOn = Main.Ins.GameStateMgr.gameStatus.Undead; toggleEnableUndead.onValueChanged.AddListener(OnEnableUndead); Toggle toggleShowWayPoint = Control("ShowWayPoint").GetComponent <Toggle>(); toggleShowWayPoint.isOn = Main.Ins.GameStateMgr.gameStatus.ShowWayPoint; #if !STRIP_DBG_SETTING toggleShowWayPoint.onValueChanged.AddListener(OnShowWayPoint); if (Main.Ins.GameStateMgr.gameStatus.ShowWayPoint) { OnShowWayPoint(true); } #else Destroy(toggleShowWayPoint.gameObject); #endif Control("ChangeV107").GetComponent <Button>().onClick.AddListener(() => { OnChangeVer("1.07"); }); Control("ChangeV907").GetComponent <Button>().onClick.AddListener(() => { OnChangeVer("9.07"); }); Control("UnlockAll").GetComponent <Button>().onClick.AddListener(() => { U3D.UnlockLevel(); }); //粒子特效 Toggle toggleDisableParticle = Control("Particle").GetComponent <Toggle>(); toggleDisableParticle.isOn = Main.Ins.GameStateMgr.gameStatus.DisableParticle; toggleDisableParticle.onValueChanged.AddListener(OnDisableParticle); OnDisableParticle(toggleDisableParticle.isOn); //关闭摇杆 Toggle toggleDisableJoyStick = Control("Joystick").GetComponent <Toggle>(); toggleDisableJoyStick.isOn = Main.Ins.GameStateMgr.gameStatus.DisableJoystick; toggleDisableJoyStick.onValueChanged.AddListener(OnDisableJoyStick); OnDisableJoyStick(toggleDisableJoyStick.isOn); Toggle toggleSkipVideo = Control("SkipVideo").GetComponent <Toggle>(); toggleSkipVideo.isOn = Main.Ins.GameStateMgr.gameStatus.SkipVideo; toggleSkipVideo.onValueChanged.AddListener(OnSkipVideo); Toggle toggleOnlyWifi = Control("OnlyWifi").GetComponent <Toggle>(); toggleOnlyWifi.isOn = Main.Ins.GameStateMgr.gameStatus.OnlyWifi; toggleOnlyWifi.onValueChanged.AddListener(OnOnlyWifi); GameObject pluginTab = Control("PluginTab", WndObject); GameObject debugTab = Control("DebugTab", WndObject); Control("PluginPrev").GetComponent <Button>().onClick.AddListener(OnPrevPagePlugin); Control("PluginNext").GetComponent <Button>().onClick.AddListener(OnNextPagePlugin); Control("AnimationDebug").GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); UnityEngine.SceneManagement.SceneManager.LoadScene("DebugScene0"); }); Control("SfxDebug").GetComponent <Button>().onClick.AddListener(() => { OnBackPress(); UnityEngine.SceneManagement.SceneManager.LoadScene("DebugScene1"); }); PluginRoot = Control("Content", pluginTab); DebugRoot = Control("Content", debugTab); //模组分页内的功能设定 Control("DeletePlugin").GetComponent <Button>().onClick.AddListener(() => { U3D.DeletePlugins(); SettingDialogState.Instance.ShowTab(4); }); Toggle togShowInstallPlugin = Control("ShowInstallToggle").GetComponent <Toggle>(); togShowInstallPlugin.onValueChanged.AddListener((bool value) => { this.showInstallPlugin = value; Main.Ins.DlcMng.CollectAll(this.showInstallPlugin); this.PluginPageRefreshEx(); }); togShowInstallPlugin.isOn = true; //透明度设定 Control("AlphaSliderBar").GetComponent <Slider>().value = Main.Ins.GameStateMgr.gameStatus.UIAlpha; Control("AlphaSliderBar").GetComponent <Slider>().onValueChanged.AddListener(OnUIAlphaChange); Control("InstallAll").GetComponent <Button>().onClick.AddListener(OnInstallAll); if (Main.Ins.AppInfo.AppVersionIsSmallThan(Main.Ins.GameNotice.newVersion)) { //需要更新,设置好服务器版本号,设置好下载链接 Control("NewVersionSep", WndObject).SetActive(true); Control("NewVersion", WndObject).GetComponent <Text>().text = string.Format("最新版本号:{0}", Main.Ins.GameNotice.newVersion); Control("NewVersion", WndObject).SetActive(true); Control("GetNewVersion", WndObject).GetComponent <LinkLabel>().URL = Main.Ins.GameNotice.apkUrl; Control("GetNewVersion", WndObject).SetActive(true); Control("Flag", WndObject).SetActive(true); } UITab[] tabs = WndObject.GetComponentsInChildren <UITab>(); for (int i = 0; i < tabs.Length; i++) { tabs[i].onValueChanged.AddListener(OnTabShow); } }
//把飞镖显示出来.尺寸*2,否则看不清 public void LoadWeapon() { InventoryItem item = Weapon; if (item.Info().MainType == (int)EquipType.Weapon) { float scale = 2.0f; WeaponDatas.WeaponDatas weaponProperty = U3D.GetWeaponProperty(item.Info().UnitId); string weaponR = ""; weaponR = weaponProperty.WeaponR; if (!string.IsNullOrEmpty(weaponR)) { GameObject weaponPrefab = ResMng.LoadPrefab(weaponR) as GameObject; if (weaponPrefab == null) { GMCFile fGmcL = Main.Ins.GMCLoader.Load(weaponR); DesFile fDesL = Main.Ins.DesLoader.Load(weaponR); if (fGmcL != null && fDesL != null) { GenerateWeaponModel(weaponR, fGmcL, fDesL, scale, weaponProperty.TextureL); } else if (fGmcL == null && fDesL != null) { GMBFile fGmbL = Main.Ins.GMBLoader.Load(weaponR); GenerateWeaponModel(weaponR, fGmbL, fDesL, scale, weaponProperty.TextureL); } } else { if (R != null) { DestroyImmediate(R); } GameObject objWeapon = GameObject.Instantiate(weaponPrefab); objWeapon.layer = LayerMask.NameToLayer("Flight"); R = objWeapon.transform; //L = new GameObject().transform; R.SetParent(WeaponRoot); R.localPosition = Vector3.zero; //这种导入来的模型,需要Y轴旋转180,与原系统的物件坐标系存在一些问题 R.localRotation = new Quaternion(0, 1, 0, 0); R.name = weaponR; R.localScale = Vector3.one; //每个武器只能有一个碰撞盒 BoxCollider box = R.GetComponentInChildren <BoxCollider>(); if (box != null) { box.enabled = false; //box.gameObject.tag = "Flight"; box.gameObject.layer = LayerMask.NameToLayer("Flight"); } else { Debug.LogError("新增武器上找不到碰撞盒[除了暗器火枪飞轮外都应该有碰撞盒]"); } } } } }
void CleanRes() { ResMng.Clean(); }