예제 #1
0
        private void DrawControlElements()
        {
            LabelCenter(left, locale["sets"], true);
            Label(left, locale["name"], false);
            left.MoveOffsetX(Style.LabelOffset);
            newSetName = TextField(left, newSetName, string.Empty, 0f, true);
            left.ResetX();
            left.BeginHorizontal(2);
            if (Button(left, locale["btnAdd"], false))
            {
                SkinPreset add = null;
                if (pageSelection == Humans)
                {
                    add = new HumanSkinPreset(newSetName);
                }
                else if (pageSelection == Titans)
                {
                    add = new TitanSkinPreset(newSetName);
                }
                else if (pageSelection == City)
                {
                    add = new CityPreset(newSetName);
                }
                else if (pageSelection == Forest)
                {
                    add = new ForestPreset(newSetName);
                }
                else if (pageSelection == Skyboxes)
                {
                    add = new SkyboxPreset(newSetName);
                }
                else if (pageSelection == Custom)
                {
                    add = new CustomMapPreset(newSetName);
                }
                if (add != null)
                {
                    presets.Add(add);
                    skinSelection = presets.Count - 1;
                    newSetName    = locale["set"] + " " + (presets.Count + 1).ToString();
                    presetLabels  = new string[presets.Count];
                    for (int i = 0; i < presetLabels.Length; i++)
                    {
                        presetLabels[i] = presets[i].Name;
                    }
                }
            }
            left.MoveX();
            if (Button(left, locale["btnDelete"], true))
            {
                if (skinSelection >= 0)
                {
                    presets[skinSelection].Delete();
                    presets.RemoveAt(skinSelection);
                }
                skinSelection = presets.Count > 0 ? presets.Count - 1 : -1;
                presetLabels  = new string[presets.Count];
                for (int i = 0; i < presetLabels.Length; i++)
                {
                    presetLabels[i] = presets[i].Name;
                }
            }
            left.ResetX();

            scrollArea.y = left.y;
            left.MoveToEndY(BoxPosition, Style.Height + Style.VerticalMargin);
            scrollArea.height = left.y - scrollArea.y;
            scrollRect.Reset();
            scrollAreaView.height = (Style.Height * presetLabels.Length) + (Style.VerticalMargin * (presetLabels.Length + 1));


            scroll        = BeginScrollView(scrollArea, scroll, scrollAreaView);
            skinSelection = SelectionGrid(scrollRect, skinSelection, presetLabels, 1, true);
            EndScrollView();
        }
예제 #2
0
    private void LoadSkinCheck()
    {
        if (Level.Name.Contains("City"))
        {
            if (SkinSettings.SkinsCheck(SkinSettings.CitySkins))
            {
                if (SkinSettings.CitySet.Value != StringSetting.NotDefine)
                {
                    var set = new CityPreset(SkinSettings.CitySet);
                    set.Load();
                    var n = "";
                    for (var i = 0; i < 250; i++)
                    {
                        var val = Random.Range(0, 8);
                        n += val.ToString();
                    }

                    var urls  = string.Join(",", set.Houses) + ",";
                    var urls2 = $"{set.Ground},{set.Wall},{set.Gate}";
                    var box   = new string[6].Select(x => "").ToArray();
                    if (set.LinkedSkybox != StringSetting.NotDefine)
                    {
                        var boxSet = new SkyboxPreset(set.LinkedSkybox);
                        boxSet.Load();
                        box = boxSet.ToSkinData();
                    }

                    LoadMapSkin(n, urls, urls2, box);
                    if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && PhotonNetwork.IsMasterClient &&
                        SkinSettings.CitySkins.Value != 2)
                    {
                        BasePV.RPC("loadskinRPC", PhotonTargets.OthersBuffered, n, urls, urls2, box);
                    }
                }
            }
        }
        else if (Level.MapName.Contains("Forest"))
        {
            if (SkinSettings.SkinsCheck(SkinSettings.ForestSkins))
            {
                if (SkinSettings.ForestSet.Value != StringSetting.NotDefine)
                {
                    var set = new ForestPreset(SkinSettings.ForestSet);
                    set.Load();
                    var n = "";
                    for (var i = 0; i < 150; i++)
                    {
                        var val = Random.Range(0, 8);
                        n += val.ToString();
                        if (set.RandomizePairs)
                        {
                            n += Random.Range(0, 8).ToString();
                        }
                        else
                        {
                            n += val.ToString();
                        }
                    }

                    var urls  = string.Join(",", set.Trees) + ",";
                    var urls2 = string.Join(",", set.Leaves);
                    urls2 += "," + set.Ground;
                    var box = new string[6].Select(x => "").ToArray();
                    if (set.LinkedSkybox != StringSetting.NotDefine)
                    {
                        var boxSet = new SkyboxPreset(set.LinkedSkybox);
                        boxSet.Load();
                        box = boxSet.ToSkinData();
                    }

                    LoadMapSkin(n, urls, urls2, box);
                    if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && PhotonNetwork.IsMasterClient &&
                        SkinSettings.ForestSkins.Value != 2)
                    {
                        BasePV.RPC("loadskinRPC", PhotonTargets.OthersBuffered, n, urls, urls2, box);
                    }
                }
            }
        }
    }
예제 #3
0
 private void CityPageEnable()
 {
     InitPresets(SkinSettings.CitySet, CityPreset.GetAllPresets());
 }