// Use this for initialization void Start() { if (textToUpdateWithScore == null) { Debug.LogError("TextToUpadteWithScore not set, this script won't work properly!"); } if (playerSettings == null) { // Try to find it within the scene as a tag GameObject go = GameObject.FindGameObjectWithTag("PlayerSettings"); if (go != null) { playerSettings = go.GetComponent<PlayerSettings>(); } if (playerSettings == null) { Debug.LogError("PlayerSettings object not found or not set, this script won't work properly!"); } } RectTransform rect = this.transform as RectTransform; originalPanelSize.x = Mathf.Abs( rect.rect.xMax - rect.rect.xMin ); originalPanelSize.y = Mathf.Abs( rect.rect.yMax - rect.rect.yMin ); originalFontSize = textToUpdateWithScore.fontSize; RenderInternal(); }
// Use this for initialization void Start() { if (playerSettings == null) { // Try to find it within the scene as a tag GameObject go = GameObject.FindGameObjectWithTag("PlayerSettings"); playerSettings = go.GetComponent<PlayerSettings>(); } if (playerSettings != null) { foreach(SpellBase spell in playerSettings.AvailableSpells) { spell.SpellActivated -= HandleSpellActivated; spell.SpellActivated += HandleSpellActivated; } } GameObject[] objects = GameObject.FindGameObjectsWithTag("SpellRenderer"); ToggleGroup toggleGroup = GetComponent<ToggleGroup>(); bool firstGroup = true; foreach(GameObject go in objects) { // Set up each renderer RenderSpells rs = go.GetComponent<RenderSpells>(); if (rs != null && playerSettings != null) { Debug.Log ("Setting spells on " + go.name); rs.toggleGroupToUse = toggleGroup; firstGroup = rs.SetSpells(playerSettings.AvailableSpells, firstGroup); } } }
public AWSettings() { Sound = new SoundSettings(); Net = new NetSettings(); Graphics = new GraphicsSettings(); Players = new PlayerSettings(); Controls = new ControlsSettings(); System = new SystemSettings(); }
/// <summary> /// Constructor /// </summary> public PlayerSetup() { InitializeComponent(); mPlayerAAlgoComboBox.SelectedIndex = 0; mPlayerBAlgoComboBox.SelectedIndex = 2; PlayerA = new PlayerSettings(); PlayerB = new PlayerSettings(); }
// Use this for initialization void Start() { mainMenu = GameObject.Find("Main Menu"); instructions = GameObject.Find("Instructions"); //toggle = GameObject.Find("AlwaysRunToggle").GetComponent<Toggle>(); difficultyText = GameObject.Find("DifficultyDisplay").GetComponent<Text>(); playerSettings = GameObject.FindWithTag("Settings").GetComponent<PlayerSettings>(); mainMenu.SetActive(true); instructions.SetActive(false); }
public void AddPlayer() { if (totalPlayersInThisDisciplina > 10) { savedPlayers.RemoveAt(0); } PlayerSettings playerSettings = new PlayerSettings(); playerSettings = myPlayerSettings; savedPlayers.Add(playerSettings); SavePlayers(Data.Instance.settings.disciplinaId); }
public CAPlayer(int id = -1) { this.Index = id; if (id != -1) { this.TSPlayer = TShock.Players[id]; } if (CAMain.Channels[0] != null) this.Channel = 0; if (CAMain.config.FilterDeathMsgByDefault) this.Flags |= PlayerSettings.HideDeathMsg; if (CAMain.config.FilterJoinQuitByDefault) this.Flags |= PlayerSettings.HideJoinQuitMsg; }
void Start() { Events.OnCustomizerSave += OnCustomizerSave; clothSettings = Data.Instance.clothesSettings; myPlayerSettings = new PlayerSettings(); int sex = PlayerPrefs.GetInt("sex", 0); if (sex == 0) myPlayerSettings.sex = PlayerSettings.sexType.VARON; else myPlayerSettings.sex = PlayerSettings.sexType.MUJER; myPlayerSettings.clothes = PlayerPrefs.GetInt("clothes", 0); myPlayerSettings.legs = PlayerPrefs.GetInt("legs", 0); myPlayerSettings.shoes = PlayerPrefs.GetInt("shoes", 0); myPlayerSettings.skin = PlayerPrefs.GetInt("skin", 0); myPlayerSettings.hairs = PlayerPrefs.GetInt("hairs", 0); }
public void GetStatusValue() { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(GameAsset.text); XmlNodeList setting_values = xmlDoc.GetElementsByTagName(playersSettingsTag); playersSettings = new List<PlayerSettings>(); foreach (XmlNode setting_value in setting_values) { XmlNodeList status_contents = setting_value.ChildNodes; PlayerSettings playerSettings = new PlayerSettings(); playerSettings.statusValues = new Dictionary<string, string>(); foreach (XmlNode status_content in status_contents) { foreach (string tag_name in Enum.GetNames(typeof(TagNames))) { if (status_content.Name == tag_name) { playerSettings.statusValues.Add(tag_name, status_content.InnerText); } } } playersSettings.Add(playerSettings); } }
/// <summary> /// Initializes a new instance of the <see cref="ScreenManager"/> class. /// </summary> /// <param name="graphicsManager">The graphics manager.</param> /// <param name="contentManager">The content manager.</param> /// <param name="gameObjectManager">The game object manager.</param> /// <param name="settings">The settings.</param> /// <param name="gameSettings">The game settings.</param> /// <param name="shaderManager">The shader manager.</param> /// <param name="audioManager">The audio manager.</param> /// <param name="playerSettings">The player settings.</param> public ScreenManager( IBallerburgGraphicsManager graphicsManager, IContentManager contentManager, IGameObjectManager gameObjectManager, ApplicationSettings settings, IGameSettingsManager gameSettings, IShaderManager shaderManager, AudioManager audioManager, PlayerSettings[] playerSettings) { // Load content belonging to the screen manager. this.graphicsManager = graphicsManager; this.contentManager = contentManager; this.gameObjectManager = gameObjectManager; this.GameSettings = gameSettings; this.shaderManager = shaderManager; this.audioManager = audioManager; this.playerSettings = playerSettings; applicationSettings = settings; isInitialized = true; }
void Awake() { aiManager = GameObject.Find("Managers").GetComponent<AIManager>(); uiManager = Camera.main.GetComponent<UIManager>(); playerSettings = Camera.main.GetComponent<PlayerSettings>(); cameraManager = Camera.main.GetComponent<CameraManager>(); board = GameObject.Find("Board").GetComponent<Board>(); black = (GameObject)Resources.Load("Black"); white = (GameObject)Resources.Load("White"); turn = GameTurn.Player; Count = 0; WhiteCount = 0; BlackCount = 0; WhiteCantMove = false; BlackCantMove = false; playerMove = null; }
// Use this for initialization void Start() { if (textToUpdateWithMana == null) { Debug.LogError("TextToUpadteWithMana not set, this script won't work properly!"); } if (playerSettings == null) { // Try to find it within the scene as a tag GameObject go = GameObject.FindGameObjectWithTag("PlayerSettings"); if (go != null) { playerSettings = go.GetComponent<PlayerSettings>(); } if (playerSettings == null) { Debug.LogError("PlayerSettings object not found or not set, this script won't work properly!"); } } RenderInternal(); }
public PlayerSettings GetClothes(int disciplinaID, int id) { PlayerSettings playerSettings = null; string playerData; playerData = PlayerPrefs.GetString("d_" + disciplinaID + "_p" + id); if (playerData.Length > 1) { String[] textSplit = playerData.Split("_"[0]); playerSettings = new PlayerSettings(); playerSettings.username = textSplit[0]; playerSettings.color = int.Parse(textSplit[1]); playerSettings.hair = int.Parse(textSplit[2]); playerSettings.face = int.Parse(textSplit[3]); playerSettings.body = int.Parse(textSplit[4]); playerSettings.bottom = int.Parse(textSplit[5]); playerSettings.shoes = int.Parse(textSplit[6]); playerSettings.glasses = int.Parse(textSplit[7]); } return playerSettings; }
private static List <string> GetDefinesList(BuildTargetGroup group) { return(new List <string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';'))); }
public virtual bool Build(string path, PostBuildOption option) { try { var scenes = this.GetScenePaths(); var buildGroup = BuildPipeline.GetBuildTargetGroup(this.BuildTarget); //set version this.Version.Build++; EditorUtility.SetDirty(this); PlayerSettings.bundleVersion = this.Version.ToString(); AssetDatabase.SaveAssets(); //build if (!string.IsNullOrEmpty(path)) { //save last build directory EditorProjectPrefs.Local.SetString("LastBuildDirectory", System.IO.Path.GetDirectoryName(path)); //do build InputSettings cacheInputs = null; string cacheSymbols = null; Dictionary <BuildSettings.PlayerSettingOverride, object> cachePlayerSettings = null; if (this.InputSettings != null) { cacheInputs = InputSettings.LoadGlobalInputSettings(false); this.InputSettings.ApplyToGlobal(); } if (this.DefineSymbols) { cacheSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildGroup) ?? string.Empty; PlayerSettings.SetScriptingDefineSymbolsForGroup(buildGroup, this.Symbols); } if (_playerSettingOverrides.Count > 0) { cachePlayerSettings = new Dictionary <PlayerSettingOverride, object>(); foreach (var setting in _playerSettingOverrides) { if (setting.SettingInfo != null) { cachePlayerSettings[setting] = setting.SettingInfo.GetValue(null, null); try { setting.SettingInfo.SetValue(null, setting.SettingValue, null); } catch (System.Exception) { } } } } var report = BuildPipeline.BuildPlayer(scenes, path, this.BuildTarget, this.BuildOptions); if (cacheInputs != null) { cacheInputs.ApplyToGlobal(); } if (cacheSymbols != null) { PlayerSettings.SetScriptingDefineSymbolsForGroup(buildGroup, cacheSymbols); } if (cachePlayerSettings != null) { //loop backwards when resetting from cache for (int i = _playerSettingOverrides.Count - 1; i >= 0; i--) { var setting = _playerSettingOverrides[i]; if (setting.SettingInfo != null) { try { setting.SettingInfo.SetValue(null, cachePlayerSettings[setting], null); } catch (System.Exception) { } } } } if (report != null && report.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded) { //save if ((option & PostBuildOption.OpenFolder) != 0) { EditorUtility.RevealInFinder(path); } if ((option & PostBuildOption.Run) != 0) { var proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = path; proc.Start(); } return(true); } else { return(false); } } } catch (System.Exception ex) { Debug.LogException(ex); } return(false); }
public override void Update(VisualElement root) { base.Update(root); var content = root.Q("content"); var table = AddTable(content); MakeRow(table, "Active target - Android", () => EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android, () => { EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Android, BuildTarget.Android); }); MakeRow(table, "Gradle Export", () => EditorUserBuildSettings.exportAsGoogleAndroidProject, () => { EditorUserBuildSettings.exportAsGoogleAndroidProject = true; }); MakeRow(table, "Minification mode", () => EditorUserBuildSettings.androidDebugMinification == AndroidMinification.Proguard, () => { EditorUserBuildSettings.androidDebugMinification = AndroidMinification.Proguard; }); MakeRow(table, "Development mode", () => EditorUserBuildSettings.development == false, () => { EditorUserBuildSettings.development = false; }); MakeRow(table, "Scripting Backend", () => PlayerSettings.GetScriptingBackend(BuildTargetGroup.Android) == ScriptingImplementation.IL2CPP, () => { PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP); }); MakeRow(table, "Internet permissions", () => PlayerSettings.Android.forceInternetPermission, () => { PlayerSettings.Android.forceInternetPermission = true; }); MakeRow(table, "Force SD Card permissions", () => PlayerSettings.Android.forceSDCardPermission, () => { PlayerSettings.Android.forceSDCardPermission = true; }); MakeRow(table, "Installation location - external", () => PlayerSettings.Android.preferredInstallLocation == AndroidPreferredInstallLocation.PreferExternal, () => { PlayerSettings.Android.preferredInstallLocation = AndroidPreferredInstallLocation.PreferExternal; }); #if UNITY_2017_3_OR_NEWER MakeRow(table, "Limit to ARM v7 or 64 targets", () => ((PlayerSettings.Android.targetArchitectures & (AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64)) != 0) && ((PlayerSettings.Android.targetArchitectures & AndroidArchitecture.X86) == 0), () => { PlayerSettings.Android.targetArchitectures &= ~AndroidArchitecture.X86; if ((PlayerSettings.Android.targetArchitectures & (AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64)) == 0) { PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARMv7; } }); #else MakeRow(table, "Limit to ARM v7 target", () => { return(PlayerSettings.Android.targetDevice == AndroidTargetDevice.ARMv7); }, () => { PlayerSettings.Android.targetDevice = AndroidTargetDevice.ARMv7; }); #endif #if UNITY_2018_3_OR_NEWER MakeRow(table, "Stripping level", () => PlayerSettings.GetManagedStrippingLevel(BuildTargetGroup.Android) == ManagedStrippingLevel.Low, () => { PlayerSettings.SetManagedStrippingLevel(BuildTargetGroup.Android, ManagedStrippingLevel.Low); }); #else MakeRow(table, "Stripping level", () => PlayerSettings.strippingLevel == StrippingLevel.Disabled, () => { PlayerSettings.strippingLevel = StrippingLevel.Disabled; }); #endif MakeRow(table, "Engine code stripping", () => !PlayerSettings.stripEngineCode, () => { PlayerSettings.stripEngineCode = false; }); }
static void CheckStaticAndroidIssues() { AndroidSdkVersions recommendedAndroidSdkVersion = AndroidSdkVersions.AndroidApiLevel19; if ((int)PlayerSettings.Android.minSdkVersion < (int)recommendedAndroidSdkVersion && EditorUtility.DisplayDialog("Optimize Android API Level?", "To avoid legacy work-arounds, please require at least API level " + (int)recommendedAndroidSdkVersion, "Use recommended", "Skip")) { PlayerSettings.Android.minSdkVersion = recommendedAndroidSdkVersion; } var materials = Resources.FindObjectsOfTypeAll <Material> (); for (int i = 0; i < materials.Length; ++i) { if (materials [i].IsKeywordEnabled("_SPECGLOSSMAP") || materials [i].IsKeywordEnabled("_METALLICGLOSSMAP") && EditorUtility.DisplayDialog("Optimize Specular Material?", "For GPU performance, please don't use specular shader on material " + materials [i].name, "Use recommended", "Skip")) { materials [i].DisableKeyword("_SPECGLOSSMAP"); materials [i].DisableKeyword("_METALLICGLOSSMAP"); } if (materials [i].passCount > 1) { Debug.LogWarning("Please use 2 or fewer passes in material " + materials [i].name); } } #if UNITY_5_5_OR_NEWER ScriptingImplementation backend = PlayerSettings.GetScriptingBackend(UnityEditor.BuildTargetGroup.Android); if (backend != UnityEditor.ScriptingImplementation.IL2CPP && EditorUtility.DisplayDialog("Optimize Scripting Backend?", "For CPU performance, please use IL2CPP.", "Use recommended", "Skip")) { PlayerSettings.SetScriptingBackend(UnityEditor.BuildTargetGroup.Android, UnityEditor.ScriptingImplementation.IL2CPP); } #else ScriptingImplementation backend = (ScriptingImplementation)PlayerSettings.GetPropertyInt("ScriptingBackend", UnityEditor.BuildTargetGroup.Android); if (backend != UnityEditor.ScriptingImplementation.IL2CPP && EditorUtility.DisplayDialog("Optimize Scripting Backend?", "For CPU performance, please use IL2CPP.", "Use recommended", "Skip")) { PlayerSettings.SetPropertyInt("ScriptingBackend", (int)UnityEditor.ScriptingImplementation.IL2CPP, UnityEditor.BuildTargetGroup.Android); } #endif var monoBehaviours = GameObject.FindObjectsOfType <MonoBehaviour> (); System.Type effectBaseType = System.Type.GetType("UnityStandardAssets.ImageEffects.PostEffectsBase"); if (effectBaseType != null) { for (int i = 0; i < monoBehaviours.Length; ++i) { if (monoBehaviours [i].GetType().IsSubclassOf(effectBaseType)) { Debug.LogWarning("Please don't use image effects."); } } } var textures = Resources.FindObjectsOfTypeAll <Texture2D> (); int maxTextureSize = 1024 * (1 << QualitySettings.masterTextureLimit); maxTextureSize = maxTextureSize * maxTextureSize; for (int i = 0; i < textures.Length; ++i) { if (textures [i].filterMode == FilterMode.Trilinear && textures [i].mipmapCount == 1 && EditorUtility.DisplayDialog("Optimize Texture Filtering?", "For GPU performance, please generate mipmaps or disable trilinear filtering for texture " + textures [i].name, "Use recommended", "Skip")) { textures [i].filterMode = FilterMode.Bilinear; } } var projectors = GameObject.FindObjectsOfType <Projector> (); if (projectors.Length > 0 && EditorUtility.DisplayDialog("Optimize Projectors?", "For GPU performance, please don't use projectors.", "Use recommended", "Skip")) { for (int i = 0; i < projectors.Length; ++i) { projectors[i].enabled = false; } } if (EditorUserBuildSettings.androidBuildSubtarget != MobileTextureSubtarget.ASTC && EditorUtility.DisplayDialog("Optimize Texture Compression?", "For GPU performance, please use ASTC.", "Use recommended", "Skip")) { EditorUserBuildSettings.androidBuildSubtarget = MobileTextureSubtarget.ASTC; } var cameras = GameObject.FindObjectsOfType <Camera> (); int clearCount = 0; for (int i = 0; i < cameras.Length; ++i) { if (cameras [i].clearFlags != CameraClearFlags.Nothing && cameras [i].clearFlags != CameraClearFlags.Depth) { ++clearCount; } } if (clearCount > 2) { Debug.LogWarning("Please use 2 or fewer clears."); } }
public void RunCompileAndLink() { var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target); var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup); var arguments = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, OutputFileRelativePath(), m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration).ToList(); var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } arguments.Add($"--map-file-parser={CommandLineFormatter.PrepareFileName(GetMapFileParserPath())}"); arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(Path.GetFullPath(GetCppOutputDirectoryInStagingArea()))}"); arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup)))); arguments.AddRange(IL2CPPUtils.GetDebuggerIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); Action <ProcessStartInfo> setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; var managedDir = Path.GetFullPath(Path.Combine(m_StagingAreaData, "Managed")); RunIl2CppWithArguments(arguments, setupStartInfo, managedDir); } }
public void StartGame(Difficulty difficulty) { PlayerSettings playerA = new PlayerSettings(false, AlgorithmType.AlphaBeta, 2, false, false, EvaluationType.BetterOne); PlayerSettings playerB = null; this.difficulty = difficulty; switch (difficulty) { case Difficulty.Easy: playerB = new PlayerSettings(true, AlgorithmType.Random, 1, false, false, EvaluationType.BetterOne); break; case Difficulty.Medium: playerB = new PlayerSettings(true, AlgorithmType.AlphaBeta, 1, true, true, EvaluationType.BetterOne); break; case Difficulty.Hard: playerB = new PlayerSettings(true, AlgorithmType.AlphaBeta, 2, true, true, EvaluationType.BetterOne); break; } this.BoardElements = new List<BoardElement>(); uiConnector.StartGame(playerB, playerA); leftMouseButtonPressed = false; selectedElementFrom = null; selectedElementTo = null; SetupBoard(); }
void Start() { clothSettings = Data.Instance.clothesSettings; LoadSavedPlayers(); myPlayerSettings = new PlayerSettings(); int disciplinaID = GetComponent<Settings>().disciplinaId; }
private GameObject SpawnPlayer(PlayerSettings a_playerSettings, int a_playerNo) { PlayerSpawnerType spawnerType = PlayerSpawnerType.FFA_ONLY; // Calculate which spawner type we should search for switch (LevelSettings.Instance.gamemode) { case Gamemode.TEAMS: // Get player's team switch (a_playerSettings.team) { case Team.ALPHA: spawnerType = PlayerSpawnerType.TEAN_ALPHA; break; case Team.OMEGA: spawnerType = PlayerSpawnerType.TEAM_OMEGA; break; case Team.NONE: Debug.LogError(string.Format("Team for player {0} not set correctly, unable to spawn player", a_playerNo)); return null; } break; case Gamemode.FFA: spawnerType = PlayerSpawnerType.FFA_ONLY; break; case Gamemode.NONE: Debug.LogError(string.Format("Gamemode not set correctly, unable to spawn player {0}", a_playerNo)); return null; } // Find player spawner PlayerSpawner playerSpawner = FindPlayerSpawnerForPlayer(a_playerNo, spawnerType); // Ensure player spawner was found if (playerSpawner == null) { Debug.LogWarning(string.Format("Unable to find spawner for player: {0}", a_playerNo)); return null; } if (a_playerNo - 1 < 0 || a_playerNo - 1 >= m_players.Length) { Debug.LogError("Player number out of range! " + a_playerNo); } // Spawn player, and retain reference within global // player references GameObject player = playerSpawner.SpawnPlayer(a_playerSettings.faction); m_players[a_playerNo - 1] = player; return player; }
private void ReadyPlayer(int a_id, Faction a_faction) { // Ensure arguments are valid if (a_id < 1 || a_id > 4) { Debug.LogError("Invalid player!"); return; } else if (a_faction == Faction.NONE) { Debug.LogError("Invalid faction!"); return; } PlayerSettings playerSettings = new PlayerSettings(); // Set player preferences, and flag // player as ready m_playersReady[a_id - 1] = true; playerSettings.playing = true; playerSettings.faction = a_faction; if (m_mainMenu.isTeamsGameMode) { // Set Team 1's faction if (m_team1Faction == Faction.NONE && playerSettings.faction != m_team2Faction) { m_team1Faction = a_faction; } // Set Team 2's faction else if (m_team2Faction == Faction.NONE && playerSettings.faction != m_team1Faction) { m_team2Faction = a_faction; } if (playersReadyCount == 3 && m_team1Faction != Faction.NONE) { // Special case where three players are ready // and on the same team, last player shouldn't // be able to join that team Button[] teamOneButtons = null; switch (m_team1Faction) { case Faction.NAVY: teamOneButtons = navyButtons; break; case Faction.PIRATES: teamOneButtons = piratesButtons; break; case Faction.TINKERERS: teamOneButtons = tinkerersButtons; break; case Faction.VIKINGS: teamOneButtons = vikingsButtons; break; case Faction.NONE: Debug.LogError("Team 1's faction set to NONE, when expect not NONE"); break; } for (int i = 0; i < teamOneButtons.Length; ++i) { teamOneButtons[i].interactable = false; } } else { // Ensure once both team's factions are set // that remaining players can only select these factions DisableNonTeamFactions(); } } // Set player's faction if (a_faction == m_team1Faction) { playerSettings.team = Team.ALPHA; } else if (a_faction == m_team2Faction) { playerSettings.team = Team.OMEGA; } // Show Start Game menu if all players // are ready if (m_playersReady[0] && m_playersReady[1] && m_playersReady[2] && m_playersReady[3]) { ShowStartGameMenu(); } // Update player settings LevelSettings.Instance.SetPlayerSettings(a_id, playerSettings); Debug.Log(string.Format("Player {0} ready with faction: {1}", a_id, a_faction)); }
// Use this for initialization void Start() { if (cameraControl == null) { if ((cameraControl = this.gameObject.GetComponent<CameraControl>()) == null) { Debug.LogError("Unable to find the CameraControl to use with the SceneControl"); } } if (playerSettings == null) { // Try to find it within the scene as a tag GameObject go = GameObject.FindGameObjectWithTag("PlayerSettings"); playerSettings = go.GetComponent<PlayerSettings>(); } }
void Settings( PlayerSettings settings ) { this.settings = settings; SetPlayerColor( settings.playerColor ); }
/// <summary> /// Accept button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Accept(object sender, EventArgs e) { AlgorithmType algoA = AlgorithmType.Random; if (mPlayerAAlgoComboBox.SelectedIndex == 1) algoA = AlgorithmType.MiniMax; else if (mPlayerAAlgoComboBox.SelectedIndex == 2) algoA = AlgorithmType.AlphaBeta; else algoA = AlgorithmType.Random; EvaluationType etA = EvaluationType.FreeSpace; if (mAbetterone.Checked) etA = EvaluationType.BetterOne; EvaluationType etB = EvaluationType.FreeSpace; if (mBbetterone.Checked) etB = EvaluationType.BetterOne; PlayerA = new PlayerSettings( mPlayerAAIYes.Checked, algoA, (int)mPlayerAPlieDepth.Value, mPlayerATransYes.Checked, mPlayerAMoveYes.Checked, etA); AlgorithmType algoB = AlgorithmType.Random; if (mPlayerBAlgoComboBox.SelectedIndex == 1) algoB = AlgorithmType.MiniMax; else if (mPlayerBAlgoComboBox.SelectedIndex == 2) algoB = AlgorithmType.AlphaBeta; else algoB = AlgorithmType.Random; PlayerB = new PlayerSettings( mPlayerBAIYes.Checked, algoB, (int)mPlayerBPlieDepth.Value, mPlayerBTransYes.Checked, mPlayerBMoveYes.Checked, etB); MaxAIMoves = (int)mAIMoves.Value; RefreshRate = (int)numericUpDown1.Value; this.Visible = false; }
/// <summary> /// IOS設定複寫 /// </summary> private void OverrideSetIOS() { SDIOSSet aTmpSet = mShowSetInfo.IOSSet; // Resolution and Presentation PlayerSettings.iOS.requiresFullScreen = aTmpSet.RequiresFullScreen; PlayerSettings.statusBarHidden = aTmpSet.StatusBarHidden; PlayerSettings.iOS.statusBarStyle = aTmpSet.StatusBarStyle; PlayerSettings.iOS.showActivityIndicatorOnLoading = aTmpSet.ShowActivityIndicatorOnLoading; // Debugging and crash reporting PlayerSettings.actionOnDotNetUnhandledException = aTmpSet.ActionOnDotNetUnhandledException; PlayerSettings.logObjCUncaughtExceptions = aTmpSet.LogObjCUncaughtExceptions; PlayerSettings.enableCrashReportAPI = aTmpSet.EnableCrashReportAPI; // Identification PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, aTmpSet.BundleIDIOS); PlayerSettings.iOS.buildNumber = aTmpSet.BuildNumber; PlayerSettings.iOS.appleEnableAutomaticSigning = aTmpSet.AppleEnableAutomaticSigning; PlayerSettings.iOS.appleDeveloperTeamID = aTmpSet.AppleDeveloperTeamID; PlayerSettings.iOS.iOSManualProvisioningProfileID = aTmpSet.ProvisioningProfileID; // Configuration PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, aTmpSet.ScriptingBackend); PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.iOS, aTmpSet.ApiCompatibilityLevel); PlayerSettings.iOS.targetDevice = aTmpSet.TargetDevice; PlayerSettings.iOS.sdkVersion = aTmpSet.SDKVersion; PlayerSettings.iOS.targetOSVersionString = aTmpSet.TargetOSVersionString; SDDataMove.SetBoolPalyerSetting("Prepare IOS For Recording", aTmpSet.PrepareIOSForRecording); PlayerSettings.iOS.requiresPersistentWiFi = aTmpSet.RequiresPersistentWiFi; PlayerSettings.iOS.appInBackgroundBehavior = aTmpSet.AppInBackgroundBehavior; if (mShowSetInfo.IOSSet.ScriptingBackend == ScriptingImplementation.IL2CPP && mShowSetInfo.IOSSet.SDKVersion == iOSSdkVersion.DeviceSDK) { PlayerSettings.SetArchitecture(BuildTargetGroup.iOS, aTmpSet.Architecture); } // Optimization PlayerSettings.iOS.scriptCallOptimization = aTmpSet.ScriptCallOptimizationLevel; if (aTmpSet.ScriptingBackend == ScriptingImplementation.IL2CPP) { PlayerSettings.stripEngineCode = aTmpSet.StripEngineCode; } else if (aTmpSet.ScriptingBackend == ScriptingImplementation.Mono2x) { PlayerSettings.strippingLevel = aTmpSet.StripLevel; } // Scripting Define Symbols PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, aTmpSet.ScriptDefineSymblos); // Icon if (aTmpSet.IconSetStatus) { if (aTmpSet.IconOverride) { SDDataMove.SetIconsGroup(BuildTargetGroup.iOS, aTmpSet.DefIcons); } else { SDDataMove.ClearnIconsGroup(BuildTargetGroup.iOS); } } PlayerSettings.iOS.prerenderedIcon = aTmpSet.PrerenderedIcon; // Splash if (aTmpSet.SplashSetStatus) { for (int i = 0; i < mShowSetInfo.IOSSet.SplashImages.Length; i++) { SDDataMove.SetSplashScreen((eMobileSplashScreen)i, mShowSetInfo.IOSSet.SplashImages[i]); } } //---------------------------------------- // Unity5 New PlayerSettings.SetGraphicsAPIs(BuildTarget.iOS, aTmpSet.GraphicsType); }
public void LoadSavedPlayers() { savedPlayers.Clear(); totalPlayersInThisDisciplina = 1; int disciplinaID = Data.Instance.settings.disciplinaId; string playerData; for (int a = 1; a < 11; a++) { playerData = PlayerPrefs.GetString("d_" + disciplinaID + "_p" + a); if (playerData.Length > 1) { String[] textSplit = playerData.Split("_"[0]); PlayerSettings playerSettings = new PlayerSettings(); playerSettings.username = textSplit[0]; playerSettings.color = int.Parse(textSplit[1]); playerSettings.hair = int.Parse(textSplit[2]); playerSettings.face = int.Parse(textSplit[3]); playerSettings.body = int.Parse(textSplit[4]); playerSettings.bottom = int.Parse(textSplit[5]); playerSettings.shoes = int.Parse(textSplit[6]); playerSettings.glasses = int.Parse(textSplit[7]); savedPlayers.Add(playerSettings); totalPlayersInThisDisciplina++; } } }
void OnGUI() { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.BeginVertical(); { EditorGUILayout.LabelField("Player Settings", EditorStyles.boldLabel); EditorGUILayout.BeginVertical("box"); { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("CompanyName", GUILayout.Width(120f)); var companyName = EditorGUILayout.TextField(PlayerSettings.companyName, GUILayout.Width(150f)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("ProductName", GUILayout.Width(120f)); var productName = EditorGUILayout.TextField(PlayerSettings.productName, GUILayout.Width(150f)); EditorGUILayout.EndHorizontal(); if (companyName != PlayerSettings.companyName || productName != PlayerSettings.productName) { PlayerSettings.companyName = companyName; PlayerSettings.productName = productName; var identifier = string.Format("com.{0}.{1}", companyName?.ToLower(), productName?.ToLower()); PlayerSettings.SetApplicationIdentifier(EditorUserBuildSettings.selectedBuildTargetGroup, identifier); } EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(new GUIContent("Bundle Identifier", "Package Name"), GUILayout.Width(120f)); var identifier = EditorGUILayout.TextField(PlayerSettings.applicationIdentifier, GUILayout.Width(150f)); if (identifier != PlayerSettings.applicationIdentifier) { PlayerSettings.SetApplicationIdentifier(EditorUserBuildSettings.selectedBuildTargetGroup, identifier); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(new GUIContent("Version*", "App Version"), GUILayout.Width(120f)); var version = EditorGUILayout.TextField(PlayerSettings.bundleVersion, GUILayout.Width(80f)); if (version != buildSettings.version) { buildSettings.version = version; PlayerSettings.bundleVersion = version; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(new GUIContent("Build", "BundleVersionCode. Auto increase when building assetbundle."), GUILayout.Width(120f)); buildSettings.bundleVersionCode = EditorGUILayout.IntField(buildSettings.bundleVersionCode, GUILayout.Width(50f)); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(new GUIContent("Bundle Version", "Version + Build. Final release version number."), GUILayout.Width(120f)); GUILayout.Label(string.Format("{0}.{1}", buildSettings.version, buildSettings.bundleVersionCode.ToString())); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); } buildSettings.zip = GUILayout.Toggle(buildSettings.zip, "Zip All Assets"); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); { EditorGUILayout.LabelField("AssetBundle Options", EditorStyles.boldLabel); EditorGUILayout.BeginVertical("box"); { var selected = DrawOption("Uncompressed AssetBundle", BuildAssetBundleOptions.UncompressedAssetBundle); if (selected) { buildSettings.RemoveOption(BuildAssetBundleOptions.ChunkBasedCompression); } selected = DrawOption("Chunk Based Compression (LZ4)", BuildAssetBundleOptions.ChunkBasedCompression); if (selected) { buildSettings.RemoveOption(BuildAssetBundleOptions.UncompressedAssetBundle); } DrawOption("Disable Write TypeTree", BuildAssetBundleOptions.DisableWriteTypeTree); DrawOption("Deterministic AssetBundle", BuildAssetBundleOptions.DeterministicAssetBundle); DrawOption("Force Rebuild AssetBundle", BuildAssetBundleOptions.ForceRebuildAssetBundle); DrawOption("Ignore TypeTree Changes", BuildAssetBundleOptions.IgnoreTypeTreeChanges); EditorGUI.BeginDisabledGroup(true); { DrawOption("Append Hash To AssetBundle Name", BuildAssetBundleOptions.AppendHashToAssetBundleName); } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); var compressMessage = string.Empty; var compressMessageType = MessageType.None; GetCompressMessage(out compressMessage, out compressMessageType); EditorGUILayout.HelpBox(compressMessage, compressMessageType); EditorGUILayout.LabelField("Build Settings", EditorStyles.boldLabel); EditorGUILayout.BeginVertical("box"); { var target = (BuildTarget)EditorGUILayout.EnumPopup(new GUIContent("Build Target"), buildSettings.buildTarget, t => EditorUtility.GetBuildPlatform((BuildTarget)t) != Platform.Unknown, false); if (target != buildSettings.buildTarget) { buildSettings.buildTarget = target; buildSettings.outPutPath = BuildHelper.GetAssetBundlesOutPutPath(target); } GUILayout.Space(10); buildSettings.outPutPath = EditorGUILayout.TextField(new GUIContent("OutPut Path"), buildSettings.outPutPath); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Browse", GUILayout.Width(100))) { var path = UnityEditor.EditorUtility.OpenFolderPanel("Select Out Put Path", System.Environment.CurrentDirectory, ""); if (!string.IsNullOrEmpty(path)) { buildSettings.outPutPath = path; } } if (GUILayout.Button("Reset", GUILayout.Width(100))) { Reset(); } GUILayout.EndHorizontal(); buildSettings.clearFolders = GUILayout.Toggle(buildSettings.clearFolders, "Clear Folders"); buildSettings.copytostreamingAssets = GUILayout.Toggle(buildSettings.copytostreamingAssets, "Copy To StreamingAssets"); GUILayout.Space(10); // EditorGUILayout.DropdownButton("Advanced Settings",) // foldout = EditorGUILayout.Foldout(foldout, "Advanced Settings"); // if (foldout) // { // buildSettings.options = (BuildAssetBundleOptions)EditorGUILayout.EnumFlagsField("Bundle Options", buildSettings.options); // } } EditorGUILayout.EndVertical(); var buildMessage = string.Empty; var buildMessageType = MessageType.None; GetBuildMessage(out buildMessage, out buildMessageType); EditorGUILayout.HelpBox(buildMessage, buildMessageType); // GUILayout.Space(20); // EditorGUILayout.TextField("???", "", "SearchTextField"); EditorGUI.BeginDisabledGroup(buildMessageType == MessageType.Error); { if (GUILayout.Button("Build")) { BuildAssetBundles(); } } EditorGUI.EndDisabledGroup(); }
public static void ConfigurePlayerSettings() { VRC.Core.Logger.Log("Setting required PlayerSettings...", VRC.Core.DebugLevel.All); SetBuildTarget(); // Needed for Microsoft.CSharp namespace in DLLMaker // Doesn't seem to work though if (PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup) != ApiCompatibilityLevel.NET_4_6) { PlayerSettings.SetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup, ApiCompatibilityLevel.NET_4_6); } if (!PlayerSettings.runInBackground) { PlayerSettings.runInBackground = true; } #if !VRC_CLIENT SetDLLPlatforms("VRCCore-Standalone", false); SetDLLPlatforms("VRCCore-Editor", true); #endif SetDefaultGraphicsAPIs(); SetGraphicsSettings(); SetAudioSettings(); SetPlayerSettings(); #if VRC_CLIENT PlatformSwitcher.RefreshRequiredPackages(EditorUserBuildSettings.selectedBuildTargetGroup); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); #else // SDK // default to steam runtime in sdk (shouldn't matter) SetVRSDKs(EditorUserBuildSettings.selectedBuildTargetGroup, new string[] { "None", "OpenVR", "Oculus" }); VRC.Core.AnalyticsSDK.Initialize(VRC.Core.SDKClientUtilities.GetSDKVersionDate()); #endif #if VRC_CLIENT // VRCLog should handle disk writing PlayerSettings.usePlayerLog = false; foreach (LogType logType in Enum.GetValues(typeof(LogType)).Cast <LogType>()) { switch (logType) { case LogType.Assert: case LogType.Exception: { PlayerSettings.SetStackTraceLogType(logType, StackTraceLogType.ScriptOnly); break; } case LogType.Error: case LogType.Warning: case LogType.Log: { PlayerSettings.SetStackTraceLogType(logType, StackTraceLogType.None); break; } default: { throw new ArgumentOutOfRangeException(); } } } #endif }
public static bool BuildingForDotNet(BuildTarget buildTarget, bool buildingForEditor, string assemblyName) { return(buildTarget == BuildTarget.WSAPlayer && CSharpLanguage.GetCSharpCompiler(buildTarget, buildingForEditor, assemblyName) == CSharpCompiler.Microsoft && PlayerSettings.GetScriptingBackend(BuildPipeline.GetBuildTargetGroup(buildTarget)) == ScriptingImplementation.WinRTDotNET); }
private void ConvertPlayerDlltoCpp(Il2CppBuildPipelineData data, string outputDirectory, string workingDirectory, bool platformSupportsManagedDebugging) { ProcessBuildPipelineOnBeforeConvertRun(m_PlatformProvider.buildReport, data); var arguments = new List <string>(); arguments.Add("--convert-to-cpp"); if (m_PlatformProvider.emitNullChecks) { arguments.Add("--emit-null-checks"); } if (m_PlatformProvider.enableStackTraces) { arguments.Add("--enable-stacktrace"); } if (m_PlatformProvider.enableArrayBoundsCheck) { arguments.Add("--enable-array-bounds-check"); } if (m_PlatformProvider.enableDivideByZeroCheck) { arguments.Add("--enable-divide-by-zero-check"); } if (m_PlatformProvider.development && m_PlatformProvider.enableDeepProfilingSupport) { arguments.Add("--enable-deep-profiler"); } if (m_BuildForMonoRuntime) { arguments.Add("--mono-runtime"); } var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target); var apiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup); arguments.Add(string.Format("--dotnetprofile=\"{0}\"", IL2CPPUtils.ApiCompatibilityLevelToDotNetProfileArgument(apiCompatibilityLevel))); var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder(); if (il2CppNativeCodeBuilder != null) { var compilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup); Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder); arguments.AddRange(Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, OutputFileRelativePath(), m_PlatformProvider.includePaths, m_PlatformProvider.libraryPaths, compilerConfiguration)); } arguments.AddRange(IL2CPPUtils.GetDebuggerIL2CPPArguments(m_PlatformProvider, buildTargetGroup)); foreach (var buildingArgument in IL2CPPUtils.GetBuildingIL2CPPArguments(m_PlatformProvider, buildTargetGroup)) { if (!arguments.Contains(buildingArgument)) { arguments.Add(buildingArgument); } } arguments.Add($"--map-file-parser={CommandLineFormatter.PrepareFileName(GetMapFileParserPath())}"); var additionalArgs = IL2CPPUtils.GetAdditionalArguments(); if (!string.IsNullOrEmpty(additionalArgs)) { arguments.Add(additionalArgs); } arguments.Add($"--directory={CommandLineFormatter.PrepareFileName(Path.GetFullPath(data.inputDirectory))}"); arguments.Add($"--generatedcppdir={CommandLineFormatter.PrepareFileName(Path.GetFullPath(outputDirectory))}"); // NOTE: any arguments added here that affect how generated code is built need // to also be added to PlatformDependent\Win\Extensions\Managed\VisualStudioProjectHelpers.cs // as that file generated project files that invoke back into IL2CPP in order to build // generated code string progressMessage = "Converting managed assemblies to C++"; if (il2CppNativeCodeBuilder != null) { progressMessage = "Building native binary with IL2CPP..."; } if (EditorUtility.DisplayCancelableProgressBar("Building Player", progressMessage, 0.3f)) { throw new OperationCanceledException(); } Action <ProcessStartInfo> setupStartInfo = null; if (il2CppNativeCodeBuilder != null) { setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo; } if (PlayerBuildInterface.ExtraTypesProvider != null) { var extraTypes = new HashSet <string>(); foreach (var extraType in PlayerBuildInterface.ExtraTypesProvider()) { extraTypes.Add(extraType); } var tempFile = Path.GetFullPath(Path.Combine(m_TempFolder, "extra-types.txt")); File.WriteAllLines(tempFile, extraTypes.ToArray()); arguments.Add($"--extra-types-file={CommandLineFormatter.PrepareFileName(tempFile)}"); } RunIl2CppWithArguments(arguments, setupStartInfo, workingDirectory); }
void FixDXRAutoGraphicsAPI() => PlayerSettings.SetUseDefaultGraphicsAPIs(CalculateSelectedBuildTarget(), false);
public static bool BuildAppxFromSLN(string productName, string msBuildVersion, bool forceRebuildAppx, string buildConfig, string buildPlatform, string buildDirectory, bool incrementVersion, bool showDialog = true) { EditorUtility.DisplayProgressBar("Build AppX", "Building AppX Package...", 0); string slnFilename = Path.Combine(buildDirectory, PlayerSettings.productName + ".sln"); if (!File.Exists(slnFilename)) { Debug.LogError("Unable to find Solution to build from!"); EditorUtility.ClearProgressBar(); return(false); } // Get and validate the msBuild path... var msBuildPath = CalcMSBuildPath(msBuildVersion); if (!File.Exists(msBuildPath)) { Debug.LogErrorFormat("MSBuild.exe is missing or invalid (path={0}).", msBuildPath); EditorUtility.ClearProgressBar(); return(false); } // Get the path to the NuGet tool string unity = Path.GetDirectoryName(EditorApplication.applicationPath); System.Diagnostics.Debug.Assert(unity != null, "unity != null"); string storePath = Path.GetFullPath(Path.Combine(Path.Combine(Application.dataPath, ".."), buildDirectory)); string solutionProjectPath = Path.GetFullPath(Path.Combine(storePath, productName + @".sln")); // Bug in Unity editor that doesn't copy project.json and project.lock.json files correctly if solutionProjectPath is not in a folder named UWP. if (!File.Exists(storePath + "\\project.json")) { File.Copy(unity + @"\Data\PlaybackEngines\MetroSupport\Tools\project.json", storePath + "\\project.json"); } string nugetPath = Path.Combine(unity, @"Data\PlaybackEngines\MetroSupport\Tools\NuGet.exe"); string assemblyCSharp = storePath + "/GeneratedProjects/UWP/Assembly-CSharp"; string assemblyCSharpFirstPass = storePath + "/GeneratedProjects/UWP/Assembly-CSharp-firstpass"; bool restoreFirstPass = Directory.Exists(assemblyCSharpFirstPass); // Before building, need to run a nuget restore to generate a json.lock file. Failing to do // this breaks the build in VS RTM if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.WinRTDotNET && (!RestoreNugetPackages(nugetPath, storePath) || !RestoreNugetPackages(nugetPath, storePath + "\\" + productName) || EditorUserBuildSettings.wsaGenerateReferenceProjects && !RestoreNugetPackages(nugetPath, assemblyCSharp) || EditorUserBuildSettings.wsaGenerateReferenceProjects && restoreFirstPass && !RestoreNugetPackages(nugetPath, assemblyCSharpFirstPass))) { Debug.LogError("Failed to restore nuget packages"); EditorUtility.ClearProgressBar(); return(false); } EditorUtility.DisplayProgressBar("Build AppX", "Building AppX Package...", 25); // Ensure that the generated .appx version increments by modifying // Package.appxmanifest if (incrementVersion) { IncrementPackageVersion(); } // Now do the actual build var pInfo = new ProcessStartInfo { FileName = msBuildPath, CreateNoWindow = false, Arguments = string.Format("\"{0}\" /t:{1} /p:Configuration={2} /p:Platform={3} /verbosity:m", solutionProjectPath, forceRebuildAppx ? "Rebuild" : "Build", buildConfig, buildPlatform) }; // Uncomment out to debug by copying into command window //Debug.Log("\"" + vs + "\"" + " " + pInfo.Arguments); var process = new Process { StartInfo = pInfo }; try { if (!process.Start()) { Debug.LogError("Failed to start Cmd process!"); EditorUtility.ClearProgressBar(); return(false); } process.WaitForExit(); EditorUtility.ClearProgressBar(); if (process.ExitCode == 0 && showDialog && !EditorUtility.DisplayDialog("Build AppX", "AppX Build Successful!", "OK", "Open AppX Folder")) { Process.Start("explorer.exe", "/f /open," + Path.GetFullPath(BuildDeployPrefs.BuildDirectory + "/" + PlayerSettings.productName + "/AppPackages")); } if (process.ExitCode != 0) { Debug.LogError("MSBuild error (code = " + process.ExitCode + ")"); EditorUtility.DisplayDialog(PlayerSettings.productName + " build Failed!", "Failed to build appx from solution. Error code: " + process.ExitCode, "OK"); return(false); } process.Close(); process.Dispose(); } catch (Exception e) { Debug.LogError("Cmd Process EXCEPTION: " + e); EditorUtility.ClearProgressBar(); return(false); } return(true); }
private void OnGUI() { if (mBaseCfg != null) { GUILayout.BeginHorizontal(GUILayout.MinWidth(900), GUILayout.MaxWidth(1000)); //通用白名单 #region 通用白名单 GUILayout.BeginVertical(GUILayout.Width(300)); GUILayout.Label("通用定义", mStyle_Title); GUILayout.Label("无论在哪个平台,都会存在的定义哦"); GUILayout.Space(15); GUILayout.Label("TinaX预设定义"); //通用白名单 - 框架预定义部分 mScroll_CommonDefine_Defaults = EditorGUILayout.BeginScrollView(mScroll_CommonDefine_Defaults, GUILayout.MaxHeight(200), GUILayout.MaxWidth(270)); foreach (var item in SharpDefineDefault.DefineItems) { //if(mCommonSharpDefine == null) //{ // Debug.Log("a"); //} var enable = mCommonSharpDefine.Contains(item.DefineStr); if (mSelect_CommonDefine_Default_Btn == item.DefineStr) { //当前选中项 GUILayout.Label(" - " + item.Name, mStyle_SelectedItem); GUILayout.TextArea(item.Desc, 500, GUILayout.MaxWidth(270), GUILayout.MaxHeight(60)); GUILayout.Label("定义字符:" + item.DefineStr); //判断是否在配置的list中 if (enable) { //包含 GUILayout.BeginHorizontal(); GUILayout.Label(" 定义状态:已启用", GUILayout.MaxWidth(125)); if (GUILayout.Button("停用定义", GUILayout.MaxWidth(55))) { mCommonSharpDefine.Remove(item.DefineStr); } GUILayout.EndHorizontal(); } else { //不包含 GUILayout.BeginHorizontal(); GUILayout.Label(" 定义状态:未启用", GUILayout.MaxWidth(125)); if (GUILayout.Button("启用定义", GUILayout.MaxWidth(55))) { mCommonSharpDefine.Add(item.DefineStr); } GUILayout.EndHorizontal(); } } else { string btn_name; if (enable) { btn_name = "[√] " + item.Name; } else { btn_name = "[-] " + item.Name; } if (GUILayout.Button(btn_name)) { mSelect_CommonDefine_Default_Btn = item.DefineStr; } } } EditorGUILayout.EndScrollView(); //通用白名单 - 自定义 GUILayout.Label("自定义#Define"); mScroll_CommonDefine_Custom = EditorGUILayout.BeginScrollView(mScroll_CommonDefine_Custom, GUILayout.MaxHeight(200), GUILayout.MaxWidth(250)); for (int i = mCommonSharpDefine.Count - 1; i >= 0; i--) { var v = mCommonSharpDefine[i]; //判断下不是预定义内容 var flag = false; foreach (var item in SharpDefineDefault.DefineItems) { if (item.DefineStr == v) { flag = true; break; } } if (!flag) { //绘制 GUILayout.BeginHorizontal(GUILayout.MaxWidth(250)); GUILayout.Label(" - " + v); if (GUILayout.Button("移除", GUILayout.MaxWidth(35))) { mCommonSharpDefine.RemoveAt(i); } GUILayout.EndHorizontal(); } } //操作 GUILayout.Space(10); GUILayout.BeginHorizontal(); mStr_CommonDefine_Custom_Add = GUILayout.TextField(mStr_CommonDefine_Custom_Add, GUILayout.MaxWidth(190)); if (GUILayout.Button("添加自定义宏", GUILayout.MaxWidth(75))) { if (mStr_CommonDefine_Custom_Add.IsNullOrEmpty()) { EditorUtility.DisplayDialog("不太对劲", "请输入有效的自定义宏 字符呀", "我错了"); } else if (mCommonSharpDefine.Contains(mStr_CommonDefine_Custom_Add)) { EditorUtility.DisplayDialog("不太对劲", "不可以重复添加的哟", "我错了"); } else { mCommonSharpDefine.Add(mStr_CommonDefine_Custom_Add); } } GUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); #endregion #region 针对平台的定义项 GUILayout.BeginVertical(GUILayout.Width(300)); GUILayout.Label("针对平台的定义", mStyle_Title); GUILayout.Label("针对通用定义的补充,只对某些特定目标平台生效。"); GUILayout.BeginHorizontal(); GUILayout.Label("当前编辑的平台:", GUILayout.MaxWidth(110)); mSelect_Edit_BuildTargetGroup = (BuildTargetGroup)EditorGUILayout.EnumPopup(mSelect_Edit_BuildTargetGroup, GUILayout.MaxWidth(100)); GUILayout.EndHorizontal(); //确保列表 if (mSelect_Edit_BuildTargetGroup.ToString() != mCur_DefineWithTarget.TargetName) { var flag = false; foreach (var item in mBaseCfg.DefineWithTarget) { if (item.TargetName == mSelect_Edit_BuildTargetGroup.ToString()) { flag = true; mCur_DefineWithTarget = item; break; } } if (!flag) { mCur_DefineWithTarget = new TinaX.Core.XBaseConfig.S_DefineWithBuildTargetGroup(); mCur_DefineWithTarget.TargetName = mSelect_Edit_BuildTargetGroup.ToString(); if (mCur_DefineWithTarget.DefineStr == null) { mCur_DefineWithTarget.DefineStr = new List <string>(); } if (mCur_DefineWithTarget.IgnoreDefine == null) { mCur_DefineWithTarget.IgnoreDefine = new List <string>(); } mBaseCfg.DefineWithTarget.Add(mCur_DefineWithTarget); } } GUILayout.Label("配置:" + mCur_DefineWithTarget.TargetName); //框架预定义部分 GUILayout.Space(15); GUILayout.Label("TinaX预设定义"); mScroll_Target_Defalut = EditorGUILayout.BeginScrollView(mScroll_Target_Defalut, GUILayout.MaxHeight(200), GUILayout.MaxWidth(270)); foreach (var item in SharpDefineDefault.DefineItems) { var enable = mCur_DefineWithTarget.DefineStr.Contains(item.DefineStr); //检查下,在全局定义中没有的,这里才可以显示 if (mCommonSharpDefine.Contains(item.DefineStr)) { //已经有了 GUILayout.Label(" -" + item.Name + " [全局定义]"); } else { if (mSelect_Target_Default_Btn == item.DefineStr) { //当前选中项 GUILayout.Label(" - " + item.Name, mStyle_SelectedItem); GUILayout.TextArea(item.Desc, 500, GUILayout.MaxWidth(270), GUILayout.MaxHeight(60)); GUILayout.Label("定义字符:" + item.DefineStr); //判断是否在配置的list中 if (enable) { //包含 GUILayout.BeginHorizontal(); GUILayout.Label(" 定义状态:已启用", GUILayout.MaxWidth(125)); if (GUILayout.Button("停用定义", GUILayout.MaxWidth(55))) { mCur_DefineWithTarget.DefineStr.Remove(item.DefineStr); } GUILayout.EndHorizontal(); } else { //不包含 GUILayout.BeginHorizontal(); GUILayout.Label(" 定义状态:未启用", GUILayout.MaxWidth(125)); if (GUILayout.Button("启用定义", GUILayout.MaxWidth(55))) { mCur_DefineWithTarget.DefineStr.Add(item.DefineStr); } GUILayout.EndHorizontal(); } } else { string btn_name; if (enable) { btn_name = "[√] " + item.Name; } else { btn_name = "[-] " + item.Name; } if (GUILayout.Button(btn_name)) { mSelect_Target_Default_Btn = item.DefineStr; } } } } EditorGUILayout.EndScrollView(); //自定义部分【添加】 GUILayout.Label("自定义#Define"); mScroll_Target_Custom = EditorGUILayout.BeginScrollView(mScroll_Target_Custom, GUILayout.MaxHeight(150), GUILayout.MaxWidth(250)); for (int i = mCur_DefineWithTarget.DefineStr.Count - 1; i >= 0; i--) { var v = mCur_DefineWithTarget.DefineStr[i]; //判断下不是预定义内容 var flag = false; foreach (var item in SharpDefineDefault.DefineItems) { if (item.DefineStr == v) { flag = true; break; } } if (!flag) { //绘制 GUILayout.BeginHorizontal(GUILayout.MaxWidth(250)); GUILayout.Label(" - " + v); if (GUILayout.Button("移除", GUILayout.MaxWidth(35))) { mCur_DefineWithTarget.DefineStr.RemoveAt(i); } GUILayout.EndHorizontal(); } } //操作 GUILayout.Space(10); GUILayout.BeginHorizontal(); mStr_Target_Custom_Add = GUILayout.TextField(mStr_Target_Custom_Add, GUILayout.MaxWidth(190)); if (GUILayout.Button("添加自定义宏", GUILayout.MaxWidth(75))) { if (mStr_Target_Custom_Add.IsNullOrEmpty()) { EditorUtility.DisplayDialog("不太对劲", "请输入有效的自定义宏 字符呀", "我错了"); } else if (mCur_DefineWithTarget.DefineStr.Contains(mStr_Target_Custom_Add)) { EditorUtility.DisplayDialog("不太对劲", "不可以重复添加的哟", "我错了"); } else { mCur_DefineWithTarget.DefineStr.Add(mStr_Target_Custom_Add); } } GUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); //自定义部分【排除】 GUILayout.Space(10); GUILayout.Label("忽略列表"); GUILayout.Label("该定义用于忽略全局定义和当前平台定义的宏符号"); mScroll_Target_Ignore = EditorGUILayout.BeginScrollView(mScroll_Target_Ignore, GUILayout.MaxHeight(150), GUILayout.MaxWidth(250)); for (int i = mCur_DefineWithTarget.IgnoreDefine.Count - 1; i >= 0; i--) { var v = mCur_DefineWithTarget.IgnoreDefine[i]; //绘制 GUILayout.BeginHorizontal(GUILayout.MaxWidth(250)); GUILayout.Label(" - " + v); if (GUILayout.Button("移出", GUILayout.MaxWidth(35))) { mCur_DefineWithTarget.IgnoreDefine.RemoveAt(i); } GUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); //操作 GUILayout.Space(10); GUILayout.BeginHorizontal(); mStr_Target_Ignore_Add = GUILayout.TextField(mStr_Target_Ignore_Add, GUILayout.MaxWidth(190)); if (GUILayout.Button("添加忽略", GUILayout.MaxWidth(75))) { if (mStr_Target_Ignore_Add.IsNullOrEmpty()) { EditorUtility.DisplayDialog("不太对劲", "请输入有效的自定义宏 字符呀", "我错了"); } else if (mCur_DefineWithTarget.IgnoreDefine.Contains(mStr_Target_Ignore_Add)) { EditorUtility.DisplayDialog("不太对劲", "不可以重复添加的哟", "我错了"); } else { mCur_DefineWithTarget.IgnoreDefine.Add(mStr_Target_Ignore_Add); } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); #endregion #region 最终配置预览和应用 GUILayout.BeginVertical(GUILayout.Width(300)); GUILayout.Label("预览与应用设置", mStyle_Title); GUILayout.Label("当前平台:" + mSelect_Edit_BuildTargetGroup.ToString()); GUILayout.Label("在“针对平台的设置”那里切换平台哦"); GUILayout.Space(10); GUILayout.Label("当前应有定义内容:"); var define_str_arr = GetTotalDefines(); var define_str = GetDefineStr(define_str_arr); foreach (var item in define_str_arr) { GUILayout.Label(" -" + item); } GUILayout.Space(10); GUILayout.Label("定义字符串:"); GUILayout.TextArea(define_str); GUILayout.Space(10); GUILayout.Label("当前Unity中有,但配置中没有的:"); var unity_define_str = PlayerSettings.GetScriptingDefineSymbolsForGroup(mSelect_Edit_BuildTargetGroup); string[] unity_define_str_arr; if (unity_define_str.IsNullOrEmpty()) { unity_define_str_arr = new string[0]; } else if (unity_define_str.IndexOf(';') < 0) { unity_define_str_arr = new string[1] { unity_define_str }; } else { unity_define_str_arr = unity_define_str.Split(';'); } foreach (var item in unity_define_str_arr) { //Debug.Log(item); var flag = false; foreach (var i2 in define_str_arr) { if (i2 == item) { flag = true; break; } } if (!flag) { //没有 GUILayout.BeginHorizontal(); GUILayout.Label(" -" + item); if (GUILayout.Button("添加到设置", GUILayout.MaxWidth(68))) { var i = EditorUtility.DisplayDialogComplex("添加到配置", "要添加窦啊什么地方呢", "全局定义", "算了", "当前平台定义"); switch (i) { case 0: //全局定义: mCommonSharpDefine.Add(item); break; case 1: //取消 break; case 2: //添加到当前平台 mCur_DefineWithTarget.DefineStr.Add(item); break; } } GUILayout.EndHorizontal(); } } //操作 if (GUILayout.Button("覆盖到Unity设置中")) { if (EditorUtility.DisplayDialog("操作确认", "确定要将当前设定的内容覆盖进Unity设置吗?\n请仔细检查平台和字符串内容哇", "是", "算了")) { SharpDefineReadWriteUtils.CoverDefine(mSelect_Edit_BuildTargetGroup, define_str); Debug.Log("已完成设置覆盖"); } } if (GUILayout.Button("增项到Unity设置中")) { if (EditorUtility.DisplayDialog("操作确认", "确定要将当前设定的内容覆盖进Unity设置吗?\n请仔细检查平台和字符串内容哇", "是", "算了")) { foreach (var item in define_str_arr) { SharpDefineReadWriteUtils.AddDefineIfNotExist(mSelect_Edit_BuildTargetGroup, item); } Debug.Log("已完成设置增项"); } } GUILayout.EndVertical(); #endregion GUILayout.EndHorizontal(); } else { GUILayout.Label("暂时没法使用这个功能呢\n先执行一下Framework的安装流程呗\n=(:з」∠)_"); } }
internal static void BuildWearableDemo() { // Check for player support if (!CanBuildTarget(EditorUserBuildSettings.activeBuildTarget)) { Debug.LogErrorFormat(CANNOT_BUILD_ERROR_MESSAGE, WEARABLE_DEMO_PRODUCT_NAME, EditorUserBuildSettings.activeBuildTarget); return; } // Get folder path from the user for the build var folderPath = GetBuildLocation(WEARABLE_DEMO_PRODUCT_NAME); if (string.IsNullOrEmpty(folderPath)) { return; } var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget); // Cache values for the current Player Settings var originalProductName = PlayerSettings.productName; var bundleVersion = PlayerSettings.bundleVersion; var appId = PlayerSettings.GetApplicationIdentifier(buildTargetGroup); var iconGroup = PlayerSettings.GetIconsForTargetGroup(buildTargetGroup); var showSplash = PlayerSettings.SplashScreen.show; var splashStyle = PlayerSettings.SplashScreen.unityLogoStyle; var splashColor = PlayerSettings.SplashScreen.backgroundColor; var splashAnimationMode = PlayerSettings.SplashScreen.animationMode; var splashDrawMode = PlayerSettings.SplashScreen.drawMode; var splashLogos = PlayerSettings.SplashScreen.logos; // Override Player Settings for this build. EditorBuildSettingsScene[] buildScenes; if (SetBuildSettingsForWearableDemo(out buildScenes)) { var sceneAssetPaths = buildScenes.Where(x => x.enabled).Select(x => x.path).ToArray(); // Attempt to build the app var buildPlayerOptions = new BuildPlayerOptions { scenes = sceneAssetPaths, locationPathName = folderPath, target = EditorUserBuildSettings.activeBuildTarget }; var buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions); #if UNITY_2018_1_OR_NEWER if (buildReport.summary.result == BuildResult.Succeeded) #else if (string.IsNullOrEmpty(buildReport)) #endif { Debug.LogFormat(BUILD_SUCCEEDED_MESSAGE, WEARABLE_DEMO_PRODUCT_NAME); if (IsAutoShowBuildOnSuccessEnabled()) { ProjectTools.OpenFolder(folderPath); } } else { Debug.LogFormat(BUILD_FAILED_MESSAGE, WEARABLE_DEMO_PRODUCT_NAME, buildReport); } } else { Debug.LogErrorFormat(BUILD_SCENES_COULD_NOT_BE_FOUND, WEARABLE_DEMO_PRODUCT_NAME); } // Reset all PlayerSetting changes back to their original values. PlayerSettings.productName = originalProductName; PlayerSettings.bundleVersion = bundleVersion; PlayerSettings.SetApplicationIdentifier(buildTargetGroup, appId); PlayerSettings.SetIconsForTargetGroup(buildTargetGroup, iconGroup); PlayerSettings.SplashScreen.show = showSplash; PlayerSettings.SplashScreen.unityLogoStyle = splashStyle; PlayerSettings.SplashScreen.backgroundColor = splashColor; PlayerSettings.SplashScreen.animationMode = splashAnimationMode; PlayerSettings.SplashScreen.drawMode = splashDrawMode; PlayerSettings.SplashScreen.logos = splashLogos; AssetDatabase.SaveAssets(); }
private PlayerSettingsProvider() { GameObject player = GameObject.FindGameObjectWithTag("Player"); settings = player.GetComponent<PlayerSettings>(); Debug.Log("!!!!"); }
public virtual void OnPreBuild(IStepLocator locator) { // Опции билдера var opts = BuildOptions.None; if (Development) { opts |= BuildOptions.Development; } if (AllowDebugging) { opts |= BuildOptions.AllowDebugging | BuildOptions.ConnectWithProfiler; if (BuildWithDeepProfilingSupport) { opts |= BuildOptions.EnableDeepProfilingSupport; } if (ScriptsOnlyBuild) { opts |= BuildOptions.BuildScriptsOnly; } } if (ShowBuiltPlayer) { opts |= BuildOptions.ShowBuiltPlayer; } if (ForceAppendToExistProject) { opts |= BuildOptions.AcceptExternalModificationsToPlayer; } if (UseLZ4Compression) { opts |= BuildOptions.CompressWithLz4; } if (ServerBuild) { opts |= BuildOptions.EnableHeadlessMode; } #if UNITY_2021 EditorUserBuildSettings.il2CppCodeGeneration = Il2CppCodeGeneration; PlayerSettings.WebGL.debugSymbolMode = WebGLDebugSymbolMode; #endif #if UNITY_2020_2_OR_NEWER SerializedObject projectSettingsManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/ProjectSettings.asset")[0]); projectSettingsManager.FindProperty("overrideDefaultApplicationIdentifier").boolValue = true; projectSettingsManager.ApplyModifiedProperties(); #endif EditorUserBuildSettings.waitForManagedDebugger = WaitForManagedDebugger; #if UNITY_2021_3_OR_NEWER EditorUserBuildSettings.standaloneBuildSubtarget = BuildSubTarget; #endif //Scripting options var currentBuildTarget = BuildPipeline.GetBuildTargetGroup(BuildTarget); PlayerSettings.SetScriptingBackend(currentBuildTarget, ScriptingBackend); PlayerSettings.SetApiCompatibilityLevel(currentBuildTarget, ApiCompatibilityLevel); PlayerSettings.SetIl2CppCompilerConfiguration(currentBuildTarget, Il2CppCompilerConfiguration); PlayerSettings.SetManagedStrippingLevel(currentBuildTarget, CodeStrippingLevel); PlayerSettings.stripEngineCode = StripEngineCode; // Прописываем bundleId PlayerSettings.SetApplicationIdentifier(currentBuildTarget, BundleIdentifier); PlayerSettings.gcIncremental = UseIncrementalGC; PlayerSettings.allowUnsafeCode = AllowUnsafeCode; PlayerSettings.bakeCollisionMeshes = BakeCollisionMeshes; PlayerSettings.stripUnusedMeshComponents = StripUnusedMeshComponents; PlayerSettings.SetStackTraceLogType(LogType.Assert, AssertStackTraceLogType); PlayerSettings.SetStackTraceLogType(LogType.Error, ErrorStackTraceLogType); PlayerSettings.SetStackTraceLogType(LogType.Exception, ExceptionStackTraceLogType); PlayerSettings.SetStackTraceLogType(LogType.Log, LogStackTraceLogType); PlayerSettings.SetStackTraceLogType(LogType.Warning, WarningStackTraceLogType); if (string.IsNullOrEmpty(BuildDir)) { BuildDir = EditorUserBuildSettings.GetBuildLocation(BuildTarget); } // запоминаем директорию сборки EditorUserBuildSettings.SetBuildLocation(BuildTarget, BuildDir); // Собственно, сборка Debug.Log("Full build path: '" + BuildFullPath + "'"); Directory.CreateDirectory(BuildFullDir); if (!DryRun) { #if UNITY_2021_3_OR_NEWER BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions { scenes = Scenes.ToArray(), locationPathName = BuildFullPath, target = BuildTarget, subtarget = ( int )BuildSubTarget, options = opts, }; var report = BuildPipeline.BuildPlayer(buildPlayerOptions); var summary = report.summary; if (summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded) { throw new Exception($"Build failed with {report.summary.totalErrors} errors and {report.summary.totalWarnings} warnings"); } #else var report = BuildPipeline.BuildPlayer(Scenes.ToArray(), BuildFullPath, BuildTarget, opts); if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded) { throw new Exception($"Build failed with {report.summary.totalErrors} errors and {report.summary.totalWarnings} warnings"); } #endif } else { var scenes = string.Join(", ", Scenes); var optsStr = opts.ToString(); Debug.Log($"Dry Run selected. Will build player with:\nScenes: {scenes}\nBuildOptions: {optsStr}"); } }
void Start() { playerSettings = GameObject.FindWithTag("Settings").GetComponent<PlayerSettings>(); }
static void UpdatePlayerSettings() { // Unregister callback (executed only once) EditorApplication.update -= UpdatePlayerSettings; BuildTargetGroup androidBuildTarget = BuildTargetGroup.Android; BuildTargetGroup iOSBuildTarget = BuildTargetGroup.iOS; BuildTargetGroup wsaBuildTarget = BuildTargetGroup.WSA; string androidSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(androidBuildTarget); androidSymbols = androidSymbols ?? ""; if (!androidSymbols.Contains(VUFORIA_ANDROID_SETTINGS)) { if (PlayerSettings.Android.targetDevice != AndroidTargetDevice.ARMv7) { Debug.Log("Setting Android target device to ARMv7"); PlayerSettings.Android.targetDevice = AndroidTargetDevice.ARMv7; } if (PlayerSettings.Android.androidTVCompatibility) { // Disable Android TV compatibility, as this is not compatible with // portrait, portrait-upside-down and landscape-right orientations. Debug.Log("Disabling Android TV compatibility."); PlayerSettings.Android.androidTVCompatibility = false; } Debug.Log("Setting Android Graphics API to OpenGL ES 2.0."); PlayerSettings.SetGraphicsAPIs( BuildTarget.Android, new UnityEngine.Rendering.GraphicsDeviceType[] { UnityEngine.Rendering.GraphicsDeviceType.OpenGLES2 }); // Here we set the scripting define symbols for Android // so we can remember that the settings were set once. PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, androidSymbols + ";" + VUFORIA_ANDROID_SETTINGS); } string iOSSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(iOSBuildTarget); iOSSymbols = iOSSymbols ?? ""; if (!iOSSymbols.Contains(VUFORIA_IOS_SETTINGS)) { #if INCLUDE_IL2CPP int scriptingBackend = 0; if (PlayerSettings.GetPropertyOptionalInt("ScriptingBackend", ref scriptingBackend, iOSBuildTarget)) { if (scriptingBackend != (int)ScriptingImplementation.IL2CPP) { Debug.Log("Setting iOS scripting backend to IL2CPP to enable 64bit support."); PlayerSettings.SetPropertyInt("ScriptingBackend", (int)ScriptingImplementation.IL2CPP, iOSBuildTarget); } } else { Debug.LogWarning("ScriptinBackend property not available for iOS; perhaps the iOS Build Support component was not installed"); } #endif //INCLUDE_IL2CPP // Here we set the scripting define symbols for IOS // so we can remember that the settings were set once. PlayerSettings.SetScriptingDefineSymbolsForGroup(iOSBuildTarget, iOSSymbols + ";" + VUFORIA_IOS_SETTINGS); } #if UNITY_5_4_OR_NEWER #if !(UNITY_5_4_0 || UNITY_5_4_1) if (PlayerSettings.iOS.cameraUsageDescription.Length == 0) { Debug.Log("Setting default camera usage description for iOS."); PlayerSettings.iOS.cameraUsageDescription = "Camera access required for target detection and tracking"; } #endif #endif string wsaSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(wsaBuildTarget); wsaSymbols = wsaSymbols ?? ""; if (!wsaSymbols.Contains(VUFORIA_WSA_SETTINGS)) { // The Windows SDK we want to use is "Universal 10" EditorUserBuildSettings.wsaSDK = WSASDK.UWP; // We want to use the Webcam (obviously); to acheive this, UWP forces us to also require access // to the microphone (which is not so obvious) PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.WebCam, true); PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.Microphone, true); // Vuforia SDK for UWP now also requires InternetClient Access PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.InternetClient, true); // Here we set the scripting define symbols for WSA // so we can remember that the settings were set once. PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.WSA, wsaSymbols + ";" + VUFORIA_WSA_SETTINGS); } }
public SettingConfig() { PlayerSettings.GetPropertyOptionalInt("ScriptingBackend", ref scriptingBackend, BuildTargetGroup.Unknown); }
bool IsDXRAutoGraphicsAPICorrect() => !PlayerSettings.GetUseDefaultGraphicsAPIs(CalculateSelectedBuildTarget());
public static bool BuildPlatform(ProjectBuildData data, bool compress, bool saveAs, bool encrypt, bool buildAsSetup) { Debug.Log(">------------------ start build : " + data.Name + " target:" + data.Target.ToString()); EditorUserBuildSettings.SwitchActiveBuildTarget(data.Target); string symDefine = data.SymbolDefine; if (!encrypt) { if (!symDefine.Contains("DISABLE_ENCRYPT_FILES")) { symDefine += ";DISABLE_ENCRYPT_FILES"; } } ApplyPlayerSettings(data); PlayerSettings.SetScriptingDefineSymbolsForGroup( EditorUserBuildSettings.selectedBuildTargetGroup, symDefine ); AssetDatabase.Refresh(); //获取SDK目录 //string sdkDirPath = GetSDKDir(); //设置放置apk文件目录 BuildOptions options = BuildOptions.None; string dir = RELEASE_PATH + PlayerSettings.companyName + "/" + EditorUserBuildSettings.activeBuildTarget + "/"; if (saveAs) { dir = EditorUtility.OpenFolderPanel("Please select the target directory", dir, "") + "/"; } string fileName = ""; string destFileName = ""; string saveAsFileName = ""; bool compressNeeds = compress; //string apkPath = SettingAPKDir(); if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android) { fileName = CFile.GetUnusedFileName(dir, PlayerSettings.companyName, ".apk"); fileName += "_V" + data.Version; if (!encrypt) { fileName += ".apk"; } destFileName += fileName; saveAsFileName = destFileName; } else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows) { if (compressNeeds || buildAsSetup) { saveAsFileName = PlayerSettings.companyName + "_V" + data.Version; fileName = CFile.GetUnusedFileName(dir, saveAsFileName, ".exe"); saveAsFileName = fileName; destFileName = PlayerSettings.companyName + ".exe"; dir += "__tmp/"; } else { fileName = CFile.GetUnusedFileName(dir, PlayerSettings.companyName, ".exe"); destFileName = fileName; destFileName += "_V" + data.Version + ".exe"; saveAsFileName = destFileName; } } else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS) { if (compressNeeds) { dir += "__tmp/"; } destFileName += PlayerSettings.companyName; destFileName += "_" + data.Version; saveAsFileName = destFileName; } else { destFileName += PlayerSettings.companyName; saveAsFileName = destFileName; } Debug.Log("destFileName:" + destFileName); Debug.Log("saveAsFileName:" + saveAsFileName); /*//SDK转移 * if (!CopySDK(companyName, EditorUserBuildSettings.activeBuildTarget)) * { * Debug.LogError("CopySDK Error."); * return false; * }*/ //TODO 拷贝随包游戏 /*if (!CopyAssetbundles(data)) * { * Debug.LogError("Copy Assetbundles Error"); * return false; * }*/ //生成ab包 /*if (!BuildAssetBundle(data)) * { * return false; * }*/ //拷贝 //标题画面更改 if (!CopyLogo()) { return(false); } if (!CopyAssetbundles(data)) { return(false); } if (!CopyCustomAssets(data)) { return(false); } //保存配置文件 if (!SaveConfig(data, encrypt)) { return(false); } if (encrypt) { options |= BuildOptions.AcceptExternalModificationsToPlayer; } //保存配置文件 if (!BuildPlayer(dir, destFileName, options)) { return(false); } if (encrypt && !Encrypt(dir, destFileName)) { return(false); } //处理编译完成后问题 if (compressNeeds && !DoCompress(dir, destFileName, saveAsFileName)) { return(false); } if (buildAsSetup && !MakeSetup(dir, destFileName, saveAsFileName)) { return(false); } //处理编译完成后问题 if (!BuildEnd(dir)) { return(false); } PlayerSettings.SetScriptingDefineSymbolsForGroup( EditorUserBuildSettings.selectedBuildTargetGroup, data.SymbolDefine ); AssetDatabase.Refresh(); Debug.Log(">------------------ Build finished! Name: " + data.Name + " Target: " + EditorUserBuildSettings.activeBuildTarget); return(true); }
bool IsDXRDirect3D12Correct() => PlayerSettings.GetGraphicsAPIs(CalculateSelectedBuildTarget()).FirstOrDefault() == GraphicsDeviceType.Direct3D12;
public static void ApplyPlayerSettings(ProjectBuildData data) { Type type = typeof(PlayerSettings); var types = typeof(PlayerSettings).GetNestedTypes(); foreach (var nested in types) { if (!data.Settings.ContainsKey(nested.Name)) { continue; } string val = data.Settings[nested.Name]; var reader = new LitJson.JsonReader(val); while (reader.Read()) { switch (reader.Token) { case LitJson.JsonToken.PropertyName: { string key = reader.Value.ToString(); reader.Read(); var info = nested.GetProperty(key); if (info == null || !info.CanWrite) { Debug.LogWarning("ingore property:" + key); continue; } if (info.PropertyType == typeof(string)) { info.SetValue(null, reader.Value, null); } else if (info.PropertyType == typeof(bool)) { info.SetValue(null, bool.Parse(reader.Value.ToString()), null); } else if (info.PropertyType == typeof(int)) { info.SetValue(null, int.Parse(reader.Value.ToString()), null); } else if (info.PropertyType.IsEnum) { info.SetValue(null, Enum.Parse(info.PropertyType, reader.Value.ToString()), null); } else { Debug.LogWarning("unidentifiable property named:" + key + " type:" + info.PropertyType.Name); } break; } } } } foreach (var col in data.Settings) { PropertyInfo info = type.GetProperty(col.Key); if (info == null || !info.CanWrite) { Debug.LogWarning("ignore property:" + col.Key); continue; } Debug.LogWarning("set property:" + col.Key); if (info.PropertyType == typeof(string)) { info.SetValue(null, col.Value, null); } else if (info.PropertyType == typeof(bool)) { info.SetValue(null, bool.Parse(col.Value), null); } else if (info.PropertyType == typeof(int)) { info.SetValue(null, int.Parse(col.Value), null); } else if (info.PropertyType.IsEnum) { info.SetValue(null, Enum.Parse(info.PropertyType, col.Value), null); } else { Debug.LogWarning("unidentifiable field named:" + col.Key + " type:" + info.PropertyType.Name); } } if (data.Settings.ContainsKey("Icons")) { string icons = data.Settings["Icons"]; var iconsList = icons.Split(','); var iconsTextureList = new List <Texture2D>(); foreach (var str in iconsList) { var texture = AssetDatabase.LoadAssetAtPath <Texture2D>(str); iconsTextureList.Add(texture); } var group = GetBuildGroupByTarget(data.Target); var iconSizes = PlayerSettings.GetIconSizesForTargetGroup(group); if (iconSizes.Length > iconsTextureList.Count) { int count = iconSizes.Length - iconsTextureList.Count; for (int i = 0; i < count; i++) { iconsTextureList.Add(null); } } PlayerSettings.SetIconsForTargetGroup(group, iconsTextureList.ToArray()); } ApplySelectedScene(data.Scenes); if (data.DebugBuild) { EditorUserBuildSettings.development = data.DebugBuild; EditorUserBuildSettings.connectProfiler = true; EditorUserBuildSettings.allowDebugging = true; } else { EditorUserBuildSettings.development = false; EditorUserBuildSettings.connectProfiler = false; EditorUserBuildSettings.allowDebugging = false; } PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, data.SymbolDefine); PlayerSettings.bundleVersion = data.Version; AssetDatabase.Refresh(); }
private static void BuildMuteAssembly(string assemblyName, List <string> CodeDirectorys, string[] additionalReferences, CodeOptimization codeOptimization) { if (!Directory.Exists(Define.BuildOutputDir)) { Directory.CreateDirectory(Define.BuildOutputDir); } List <string> scripts = new List <string>(); for (int i = 0; i < CodeDirectorys.Count; i++) { DirectoryInfo dti = new DirectoryInfo(CodeDirectorys[i]); FileInfo[] fileInfos = dti.GetFiles("*.cs", System.IO.SearchOption.AllDirectories); for (int j = 0; j < fileInfos.Length; j++) { scripts.Add(fileInfos[j].FullName); } } string dllPath = Path.Combine(Define.BuildOutputDir, $"{assemblyName}.dll"); string pdbPath = Path.Combine(Define.BuildOutputDir, $"{assemblyName}.pdb"); File.Delete(dllPath); File.Delete(pdbPath); Directory.CreateDirectory(Define.BuildOutputDir); AssemblyBuilder assemblyBuilder = new AssemblyBuilder(dllPath, scripts.ToArray()); //启用UnSafe //assemblyBuilder.compilerOptions.AllowUnsafeCode = true; BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget); assemblyBuilder.compilerOptions.CodeOptimization = codeOptimization; assemblyBuilder.compilerOptions.ApiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup); // assemblyBuilder.compilerOptions.ApiCompatibilityLevel = ApiCompatibilityLevel.NET_4_6; assemblyBuilder.additionalReferences = additionalReferences; assemblyBuilder.flags = AssemblyBuilderFlags.None; //AssemblyBuilderFlags.None 正常发布 //AssemblyBuilderFlags.DevelopmentBuild 开发模式打包 //AssemblyBuilderFlags.EditorAssembly 编辑器状态 assemblyBuilder.referencesOptions = ReferencesOptions.UseEngineModules; assemblyBuilder.buildTarget = EditorUserBuildSettings.activeBuildTarget; assemblyBuilder.buildTargetGroup = buildTargetGroup; assemblyBuilder.buildStarted += delegate(string assemblyPath) { Debug.LogFormat("build start:" + assemblyPath); }; assemblyBuilder.buildFinished += delegate(string assemblyPath, CompilerMessage[] compilerMessages) { int errorCount = compilerMessages.Count(m => m.type == CompilerMessageType.Error); int warningCount = compilerMessages.Count(m => m.type == CompilerMessageType.Warning); Debug.LogFormat("Warnings: {0} - Errors: {1}", warningCount, errorCount); if (warningCount > 0) { Debug.LogFormat("有{0}个Warning!!!", warningCount); } if (errorCount > 0) { for (int i = 0; i < compilerMessages.Length; i++) { if (compilerMessages[i].type == CompilerMessageType.Error) { string filename = Path.GetFullPath(compilerMessages[i].file); Debug.LogError($"{compilerMessages[i].message} (at <a href=\"file:///{filename}/\" line=\"{compilerMessages[i].line}\">{Path.GetFileName(filename)}</a>)"); } } } }; //开始构建 if (!assemblyBuilder.Build()) { Debug.LogErrorFormat("build fail:" + assemblyBuilder.assemblyPath); return; } }
private static List <string> GetDefineSymbols() { return(new List <string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)).Split(';'))); }
private static EditorApplication.CallbackFunction GetSetSymbolsCallback(string symbols) { return(() => PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, symbols)); }
private static void SetDefineSymbols(List <string> symbols) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget), string.Join(";", symbols.ToArray())); }
public static bool BuildVer(PlatformType pt) { if (Application.dataPath.IndexOf(Exporter.PUBLISH_DIR) == -1) { EditorUtility.DisplayDialog("错误", "只有发布目录才能发布版本!", "OK"); return(false); } string app_name = APP_NAME; string target_dir = ExporterTools.GetRootDir(Exporter.VERSION_DIR); string target_name = app_name + RuntimeInfo.GetExt(pt); BuildTargetGroup targetGroup; BuildTarget buildTarget; PlayerSettings.bundleVersion = Exporter.CLIENT_VER.Replace('_', '.'); switch (pt) { case PlatformType.Android: targetGroup = BuildTargetGroup.Android; buildTarget = BuildTarget.Android; PlayerSettings.bundleIdentifier = "com.leduo.buyu"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "BUYU_PUBLISH"); break; case PlatformType.IOS: targetGroup = BuildTargetGroup.iOS; buildTarget = BuildTarget.iOS; PlayerSettings.bundleIdentifier = "com.52leduo.buyu"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "BUYU_PUBLISH"); break; case PlatformType.Windows: targetGroup = BuildTargetGroup.Standalone; buildTarget = BuildTarget.StandaloneWindows; PlayerSettings.bundleIdentifier = "com.52leduo.buyu"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "BUYU_PUBLISH"); break; default: Debug.Log("未知的发布类型"); return(false); } string applicationPath = target_dir + "/" + target_name; if (File.Exists(applicationPath)) { File.Delete(applicationPath); } bool bRet = GenericBuild(FindEnabledEditorScenes(), target_dir + "/" + target_name, buildTarget, BuildOptions.None); if (bRet) { EditorUtility.DisplayDialog("成功", "发布成功!", "OK"); Debug.Log("发布成功!"); return(true); } else { EditorUtility.DisplayDialog("失败", "发布失败!", "OK"); Debug.Log("发布失败!"); return(false); } }
public static void Help() { Debug.developerConsoleVisible = true; GX.Editor.LogEntries.Clear(); // 获取所有需要编译的场景列表 var levels = (from s in EditorBuildSettings.scenes where s.enabled select s.path).ToArray(); Debug.Log(string.Join("\n", levels)); // 将 Assets/DLL 下的dll文件移动到临时目录,因这些dll不能兼容WP8下的生成 Directory.CreateDirectory(Temp); try { ProtobufBegin(); WebSocket4NetBegin(); JsonFxBegin(); // 进行WP8项目生成 { #if UNITY_WP8 AssetDatabase.Refresh(); BuildPipeline.BuildPlayer(levels, "WP8", BuildTarget.WP8Player, BuildOptions.None); #elif UNITY_WINRT /* * var metroSDK = UnityEditor.EditorUserBuildSettings.metroSDK; * try * { * { * PlayerSettings.productName = "BWGame-8.0"; * UnityEditor.EditorUserBuildSettings.metroSDK = MetroSDK.SDK80; * AssetDatabase.Refresh(); * BuildPipeline.BuildPlayer(levels, "WinRT", BuildTarget.MetroPlayer, BuildOptions.None); * } * * { * PlayerSettings.productName = "BWGame-8.1"; * UnityEditor.EditorUserBuildSettings.metroSDK = MetroSDK.SDK81; * AssetDatabase.Refresh(); * BuildPipeline.BuildPlayer(levels, "WinRT", BuildTarget.MetroPlayer, BuildOptions.None); * } * } * finally * { * PlayerSettings.productName = "BWGame"; * UnityEditor.EditorUserBuildSettings.metroSDK = metroSDK; * } */ { PlayerSettings.productName = "BWGame"; UnityEditor.EditorUserBuildSettings.metroSDK = MetroSDK.UniversalSDK81; // 避免 UNITY_EDITOR* 在导出时没有被取消定义 PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Metro, string.Join(";", UnityEditor.EditorUserBuildSettings.activeScriptCompilationDefines .Where(i => i.StartsWith("UNITY_EDITOR") == false) .ToArray())); Debug.Log("DefineSymbols: " + PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Metro)); AssetDatabase.Refresh(); BuildPipeline.BuildPlayer(levels, "WS", BuildTarget.MetroPlayer, BuildOptions.None); } #endif } ProtobufEnd(); WebSocket4NetEnd(); JsonFxEnd(); Debug.Log("OK"); } catch (Exception ex) { Debug.LogException(ex); } finally { Directory.Delete(Temp, true); // 刷新资源 AssetDatabase.Refresh(); } }
public void Initialize(AppCore core, PlayerSettings player) { this.Life.Value = this.LifeMax; this.Player = player; this.Core = core; }
public static void PerformBuild(BuildInfo buildInfo) { BuildTargetGroup buildTargetGroup = GetGroup(buildInfo.BuildTarget); string oldBuildSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup); if (!string.IsNullOrEmpty(oldBuildSymbols)) { if (buildInfo.HasConfigurationSymbol()) { buildInfo.AppendSymbols(BuildInfo.RemoveConfigurationSymbols(oldBuildSymbols)); } else { buildInfo.AppendSymbols(oldBuildSymbols.Split(';')); } } if ((buildInfo.BuildOptions & BuildOptions.Development) == BuildOptions.Development) { if (!buildInfo.HasConfigurationSymbol()) { buildInfo.AppendSymbols(BuildSymbolDebug); } } if (buildInfo.HasAnySymbols(BuildSymbolDebug)) { buildInfo.BuildOptions |= BuildOptions.Development | BuildOptions.AllowDebugging; } if (buildInfo.HasAnySymbols(BuildSymbolRelease)) { //Unity automatically adds the DEBUG symbol if the BuildOptions.Development flag is //specified. In order to have debug symbols and the RELEASE symbols we have to //inject the symbol Unity relies on to enable the /debug+ flag of csc.exe which is "DEVELOPMENT_BUILD" buildInfo.AppendSymbols("DEVELOPMENT_BUILD"); } BuildTarget oldBuildTarget = EditorUserBuildSettings.activeBuildTarget; BuildTargetGroup oldBuildTargetGroup = GetGroup(oldBuildTarget); EditorUserBuildSettings.SwitchActiveBuildTarget(buildTargetGroup, buildInfo.BuildTarget); WSAUWPBuildType?oldWSAUWPBuildType = EditorUserBuildSettings.wsaUWPBuildType; if (buildInfo.WSAUWPBuildType.HasValue) { EditorUserBuildSettings.wsaUWPBuildType = buildInfo.WSAUWPBuildType.Value; } var oldWSAGenerateReferenceProjects = EditorUserBuildSettings.wsaGenerateReferenceProjects; if (buildInfo.WSAGenerateReferenceProjects.HasValue) { EditorUserBuildSettings.wsaGenerateReferenceProjects = buildInfo.WSAGenerateReferenceProjects.Value; } var oldColorSpace = PlayerSettings.colorSpace; if (buildInfo.ColorSpace.HasValue) { PlayerSettings.colorSpace = buildInfo.ColorSpace.Value; } if (buildInfo.BuildSymbols != null) { PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, buildInfo.BuildSymbols); } string buildError = "Error"; try { VerifyWsaUwpSdkIsInstalled(EditorUserBuildSettings.wsaUWPSDK); // For the WSA player, Unity builds into a target directory. // For other players, the OutputPath parameter indicates the // path to the target executable to build. if (buildInfo.BuildTarget == BuildTarget.WSAPlayer) { Directory.CreateDirectory(buildInfo.OutputDirectory); } OnPreProcessBuild(buildInfo); buildError = BuildPipeline.BuildPlayer( buildInfo.Scenes.ToArray(), buildInfo.OutputDirectory, buildInfo.BuildTarget, buildInfo.BuildOptions).ToString(); if (buildError.StartsWith("Error")) { throw new Exception(buildError); } } finally { OnPostProcessBuild(buildInfo, buildError); if (buildInfo.BuildTarget == BuildTarget.WSAPlayer && EditorUserBuildSettings.wsaGenerateReferenceProjects) { UwpProjectPostProcess.Execute(buildInfo.OutputDirectory); } PlayerSettings.colorSpace = oldColorSpace; PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, oldBuildSymbols); if (oldWSAUWPBuildType.HasValue) { EditorUserBuildSettings.wsaUWPBuildType = oldWSAUWPBuildType.Value; } EditorUserBuildSettings.wsaGenerateReferenceProjects = oldWSAGenerateReferenceProjects; EditorUserBuildSettings.SwitchActiveBuildTarget(oldBuildTargetGroup, oldBuildTarget); } }
protected string CopyImage(PlayerSettings.WSAImageType type, PlayerSettings.WSAImageScale scale, string defaultSource, string destinationFileName) { string visualAssetsImage = PlayerSettings.WSA.GetVisualAssetsImage(type, scale); if (string.IsNullOrEmpty(visualAssetsImage)) { if (string.IsNullOrEmpty(defaultSource)) { return null; } visualAssetsImage = defaultSource; } destinationFileName = Path.ChangeExtension(destinationFileName, Path.GetExtension(visualAssetsImage)); string str3 = Path.ChangeExtension(Utility.CombinePath("Assets", Path.GetFileName(!string.IsNullOrEmpty(defaultSource) ? defaultSource : visualAssetsImage)), Path.GetExtension(visualAssetsImage)); if (string.IsNullOrEmpty(destinationFileName)) { destinationFileName = str3; } else { destinationFileName = Utility.CombinePath("Assets", Path.GetFileName(destinationFileName)); } string path = Utility.CombinePath(base.StagingArea, destinationFileName); Utility.CreateDirectory(Path.GetDirectoryName(path)); FileUtil.CopyFileOrDirectory(visualAssetsImage, path); return (destinationFileName.Substring(0, destinationFileName.IndexOf('.')) + Path.GetExtension(visualAssetsImage)); }
public void StartGame(int numberOfPlayers) { isGameEnded = false; this.numberOfPlayers = numberOfPlayers; int rows = (int)Mathf.Ceil( Mathf.Sqrt( numberOfPlayers ) ); int cols = (int)Mathf.Ceil( 1f * numberOfPlayers / rows ); float cameraViewPortWidth = 1f / cols; float cameraViewPortHeight = 1f / rows; int playerIndex = 0; remainingPlayers = numberOfPlayers; OnGameStart(); for( int i=0; i<cols; i++ ){ for( int j=0; j < rows && playerIndex<numberOfPlayers; j++ ){ GameObject player = (GameObject)Instantiate( playerPrefab, spawnPositions[playerIndex].position, spawnPositions[playerIndex].rotation ); GameObject playerCamera = (GameObject)Instantiate( playerCameraPrefab ); PlayerSettings playerSettings = new PlayerSettings(); playerSettings.keys = playerKeys[playerIndex]; playerSettings.playerColor = playerColors[playerIndex]; playerSettings.player = playerIndex; player.SendMessage("SetGameController", this); player.SendMessage("SetPlayerCamera", playerCamera.camera); player.SendMessage("Settings", playerSettings); playerCamera.SendMessage("SetTarget", player ); Rect cameraRect = new Rect( i*cameraViewPortWidth, (1f - j)*cameraViewPortHeight, cameraViewPortWidth, cameraViewPortHeight ); playerCamera.camera.rect = cameraRect; playerIndex++; } } Invoke("Unpause",0.5f); }
internal static bool UseIl2CppCodegenWithMonoBackend(BuildTargetGroup targetGroup) { return(EditorApplication.useLibmonoBackendForIl2cpp && PlayerSettings.GetScriptingBackend(targetGroup) == ScriptingImplementation.IL2CPP); }
// Use this for initialization void Start() { // Start the music SoundManager.PlayBackgroundMusic(SoundManager.BackgroundMusic.Battle_Music); // Load the the tilemap file GameTileMapReference.Load(SaveClass.GetPlayerPrefString(SaveClass.Save_Keys.Key_Level), 15); // Set up the objective setObjective(); // Load Player Settings playerSetting = GetComponent<PlayerSettings>(); playerSetting.Load(); // Load weapons on player // Player 1 RPGPlayer player = PlayerList[0]; Weapon weapon = null; // Left weapon weapon = Instantiate(LeftWeapons[SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Player1_Left)]); weapon.transform.parent = player.transform; weapon.transform.position = player.transform.position; weapon.transform.localScale = new Vector3(1, 1, 1); player.LeftWeapon = weapon; // Right weapon weapon = Instantiate(RightWeapons[SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Player1_Right)]); weapon.transform.parent = player.transform; weapon.transform.position = player.transform.position; weapon.transform.localScale = new Vector3(1, 1, 1); player.RightWeapon = weapon; // Load Skin player.PlayerSkin = playerSetting.CurrentFirstSkin; // Player 2 player = PlayerList[1]; // Left weapon weapon = Instantiate(LeftWeapons[SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Player2_Left)]); weapon.transform.parent = player.transform; weapon.transform.position = player.transform.position; weapon.transform.localScale = new Vector3(1, 1, 1); player.LeftWeapon = weapon; // Right weapon weapon = Instantiate(RightWeapons[SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Player2_Right)]); weapon.transform.parent = player.transform; weapon.transform.position = player.transform.position; weapon.transform.localScale = new Vector3(1, 1, 1); player.RightWeapon = weapon; // Load Skin // -- Special Case for Second Player as we don't want to override the default skin if (playerSetting.CurrentSecondSkin != null) { player.PlayerSkin = playerSetting.CurrentSecondSkin; } }
Action ResetDisplayPanel(Widget panel) { var ds = Game.Settings.Graphics; var gs = Game.Settings.Game; var ps = Game.Settings.Player; var dds = new GraphicSettings(); var dgs = new GameSettings(); var dps = new PlayerSettings(); return () => { gs.ShowShellmap = dgs.ShowShellmap; ds.CapFramerate = dds.CapFramerate; ds.MaxFramerate = dds.MaxFramerate; ds.Language = dds.Language; ds.Mode = dds.Mode; ds.WindowedSize = dds.WindowedSize; ds.PixelDouble = dds.PixelDouble; ds.CursorDouble = dds.CursorDouble; worldRenderer.Viewport.Zoom = ds.PixelDouble ? 2 : 1; ps.Color = dps.Color; ps.Name = dps.Name; }; }
internal static string[] GetBuilderDefinedDefines(IIl2CppPlatformProvider il2cppPlatformProvider, BuildTargetGroup buildTargetGroup) { List <string> defines = new List <string>(); var apiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup); switch (apiCompatibilityLevel) { case ApiCompatibilityLevel.NET_2_0: case ApiCompatibilityLevel.NET_2_0_Subset: defines.AddRange(BaseDefines20); break; case ApiCompatibilityLevel.NET_4_6: case ApiCompatibilityLevel.NET_Standard_2_0: defines.AddRange(BaseDefines46); break; default: throw new InvalidOperationException($"IL2CPP doesn't support building with {apiCompatibilityLevel} API compatibility level!"); } var target = il2cppPlatformProvider.target; if (target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneWindows64 || target == BuildTarget.XboxOne || target == BuildTarget.WSAPlayer) { defines.AddRange(BaseDefinesWindows); if (target == BuildTarget.WSAPlayer) { defines.Add("WINAPI_FAMILY=WINAPI_FAMILY_APP"); } else { defines.Add("WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP"); } } if (EnableIL2CPPDebugger(il2cppPlatformProvider, buildTargetGroup)) { defines.Add("IL2CPP_MONO_DEBUGGER=1"); } if (BuildPipeline.IsFeatureSupported("ENABLE_SCRIPTING_GC_WBARRIERS", target)) { var hasGCBarrierValidation = PlayerSettings.gcWBarrierValidation; if (hasGCBarrierValidation) { defines.Add("IL2CPP_ENABLE_STRICT_WRITE_BARRIERS=1"); defines.Add("IL2CPP_ENABLE_WRITE_BARRIER_VALIDATION=1"); } var hasIncrementalGCTimeSlice = PlayerSettings.gcIncremental && (apiCompatibilityLevel == ApiCompatibilityLevel.NET_4_6 || apiCompatibilityLevel == ApiCompatibilityLevel.NET_Standard_2_0); if (hasGCBarrierValidation || hasIncrementalGCTimeSlice) { var timeslice = hasIncrementalGCTimeSlice ? "3" : "0"; defines.Add("IL2CPP_ENABLE_WRITE_BARRIERS=1"); defines.Add($"IL2CPP_INCREMENTAL_TIME_SLICE={timeslice}"); } } return(defines.ToArray()); }