Example #1
0
    public static void UpdateUiScale()
    {
        float value = Mathf.Clamp(FafEditorSettings.GetUiScale(), 0.25f, 4f);

        instance.canvasScaler.scaleFactor            = value;
        instance.canvasScaler.referencePixelsPerUnit = 100f / value;
    }
Example #2
0
        public static void UpdateMarkers2D()
        {
            if (!FafEditorSettings.GetMarkers2D())
            {
                return;
            }

            var ListEnum = Marker2DComponents.GetEnumerator();

            while (ListEnum.MoveNext())
            {
                if (ListEnum.Current != null)
                {
                    ListEnum.Current.UpdateScale();
                }
            }
            ListEnum.Dispose();
        }
Example #3
0
        void RecalcTerrainClamp()
        {
            FafEditorSettings.GetHeightmapClamp();

            float bmin = ScmapEditor.Current.Data.bounds.min.y;
            float bmax = ScmapEditor.Current.Data.bounds.max.y;

            HeightmapMin = (bmax - 5f) / ScmapEditor.Current.Data.size.y;
            HeightmapMax = (bmin + 5f) / ScmapEditor.Current.Data.size.y;

            if (HeightmapMin < 0f)
            {
                HeightmapMin = 0f;
            }
            if (HeightmapMax > 1f)
            {
                HeightmapMax = 1f;
            }

            //Debug.Log(bmin + " > " + bmax);
        }
Example #4
0
    public void MenuButton(string func)
    {
        if (!MenuOpen)
        {
            return;
        }
        switch (func)
        {
        case "NewMap":
            OpenNewMap();
            break;

        case "Open":
            OpenMap();
            //MapHelper.Map = false;
            //MapHelper.OpenComposition(0);
            break;

        case "OpenRecent":
            RecentMaps.SetActive(true);
            ButtonClicked = true;
            break;

        case "Save":
            MapLuaParser.Current.SaveMap();
            break;

        case "SaveAs":
            SaveMapAs();
            break;

        case "SaveAsNewVersion":
            SaveAsNewVersion();
            break;

        case "Undo":
            break;

        case "Redo":
            break;

        case "Symmetry":
            Symmetry.SetActive(true);
            break;

        case "Grid":
            ScmapEditor.Current.ToogleGrid(GridToggle.isOn);
            break;

        case "BuildGrid":
            ScmapEditor.Current.ToogleBuildGrid(BuildGridToggle.isOn);
            break;

        case "GeneralGrid":
            ScmapEditor.Current.ToogleGeneraldGrid(GeneralGridToggle.isOn);
            break;

        case "AIGrid":
            ScmapEditor.Current.ToogleAIGrid(AIGridToggle.isOn);
            break;

        case "Slope":
            ScmapEditor.Current.ToogleSlope(SlopeToggle.isOn);
            break;

        case "Ruler":
            Ruler.Toggle(RulerToggle.isOn);
            break;

        case "Forum":
            Application.OpenURL("http://forums.faforever.com/viewtopic.php?f=45&t=10647");
            break;

        case "Wiki":
            Application.OpenURL("https://wiki.faforever.com/index.php?title=FA_Forever_Map_Editor");
            break;

        case "UnitDb":
            Application.OpenURL("http://direct.faforever.com/faf/unitsDB/");
            break;

        case "EditorLog":
            ShowEditorLog();
            break;

        case "Donate":
            Application.OpenURL("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=LUYMTPBDH5V4E&lc=GB&item_name=FAF%20Map%20Editor&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted");
            break;

        case "Shortcuts":
            Application.OpenURL("https://wiki.faforever.com/index.php?title=FA_Forever_Map_Editor#Useful_shortuts");
            break;

        case "PlayMap":
            if (MapLuaParser.IsMapLoaded)
            {
                string Arguments = "";
                Arguments += "/map \"" + "/maps/" + MapLuaParser.Current.FolderName + "/" + MapLuaParser.Current.ScenarioFileName + ".lua" + "\"";
                //Arguments += "/map \"" + MapLuaParser.LoadedMapFolderPath + MapLuaParser.Current.ScenarioFileName + ".lua" + "\"";
                Arguments += " /faction " + (FafEditorSettings.GetFaction() + 1).ToString();
                Arguments += " /victory sandbox";
                Arguments += " /gamespeed adjustable";
                Arguments += " /civilians";
                Arguments += " /enablediskwatch";
                //Arguments += " / predeployed/";

                if (!FafEditorSettings.GetFogOfWar())
                {
                    Arguments += " /nofog";
                }

                string GamePath = EnvPaths.GetInstalationPath() + "bin/SupremeCommander.exe";

                if (!System.IO.File.Exists(GamePath))
                {
                    string OtherPath = EnvPaths.GetInstalationPath() + "bin/ForgedAlliance.exe";
                    if (System.IO.File.Exists(OtherPath))
                    {
                        GamePath = OtherPath;
                    }
                    else
                    {
                        Debug.LogWarning("Game executable not exist at given path: " + EnvPaths.GetInstalationPath() + "bin/");
                        return;
                    }
                }
                Debug.Log("Start game: " + GamePath);
                Debug.Log("Args: " + Arguments);

                System.Diagnostics.Process.Start(GamePath, Arguments);
            }
            break;
        }
    }