Пример #1
0
        public string GetStylesTag()
        {
            var sb = new StringBuilder();

            sb.AppendLine($"<style type=\"text/css\" scoped>");

            ThemeGenerator.GenerateStyles(sb, Theme);

            sb.AppendLine("</style>");

            return(sb.ToString());
        }
Пример #2
0
    public void SetUp(GameObject p_terrain_holder)
    {
        _terainholder   = p_terrain_holder;
        _themeGenerator = GetComponent <ThemeGenerator>();

        perlin_offsetX = Random.Range(0, 20000);
        perlin_offsetY = Random.Range(0, 20000);
        CalculateGridSize();

        _themeGenerator.GeneratePoolingObject();
        //PreparePooling();
        PrebuildMap();
    }
Пример #3
0
        public string GetVariablesTag()
        {
            var sb = new StringBuilder();

            sb.AppendLine("<style>");
            sb.AppendLine(":root");
            sb.AppendLine("{");

            ThemeGenerator.GenerateVariables(sb, Theme);

            sb.AppendLine("}");
            sb.AppendLine("</style>");

            return(sb.ToString());
        }
Пример #4
0
    private void Start()
    {
        if (ThemeGeneratorST != null)
        {
            Destroy(this);
        }
        if (ThemeGeneratorST == null)
        {
            ThemeGeneratorST = this;
        }

        for (int i = 0; i < 5; i++)
        {
            AddTheme();
        }
        RefreshThemes();
        TimeManager.DayCounterEvent += RefreshThemes;
    }
Пример #5
0
    public override void OnNotify(string p_event, params object[] p_objects)
    {
        base.OnNotify(p_event, p_objects);

        switch (p_event)
        {
        case EventFlag.Game.SetUp: {
            Debug.Log("Game Start");
            _mapGeneration   = MainApp.Instance.FindObject <MapGenerator>("model/map_generator");
            _themeGeneration = MainApp.Instance.FindObject <ThemeGenerator>("model/map_generator");
            _inputController = MainApp.Instance.GetObserver <InputController>();
            _aiDirector      = MainApp.Instance.GetObserver <AIDirector>();
            _camera          = MainApp.Instance.FindObject <CameraHandler>("view/camera");

            Init();
        }
        break;

        case EventFlag.Game.PlayerMove: {
            CA_Terrain.TerrainBuilder terrainBuilder = _mapGeneration.AssignSRandomTerrain();
            _aiDirector.AssignAgentsInSingleRow(terrainBuilder);
        };
            break;


        case EventFlag.Game.UnitAttack: {
            if (p_objects.Length == 2)
            {
                OnUnitAttack((BaseUnit)p_objects[0], (BaseUnit)p_objects[1]);
            }
        };
            break;

        case EventFlag.Game.UnitDestroy: {
            OnUnitDestroy((BaseUnit)p_objects[0]);
        }
        break;
        }
    }
Пример #6
0
        /// <summary>
        /// Apply three custom colors to the standard Office UI Fabric template and get back the JSON with the CSS rules
        /// </summary>
        /// <param name="primaryColor">Primary Color for the Theme</param>
        /// <param name="bodyTextColor">Body Text Color for the Theme</param>
        /// <param name="bodyBackgroundColor">Body Background Color for the Theme</param>
        /// <returns>THe JSON representation of the Theme</returns>
        public static String GetThemeAsJSON(String primaryColor, String bodyTextColor, String bodyBackgroundColor)
        {
            // Validate inputs
            if (String.IsNullOrEmpty(primaryColor))
            {
                throw new ArgumentNullException(nameof(primaryColor));
            }

            if (String.IsNullOrEmpty(bodyTextColor))
            {
                throw new ArgumentNullException(nameof(bodyTextColor));
            }

            if (String.IsNullOrEmpty(bodyBackgroundColor))
            {
                throw new ArgumentNullException(nameof(bodyBackgroundColor));
            }

            // Parse the custom colors
            var primaryCustomColor        = Colors.getColorFromString(primaryColor);
            var bodyTextCustomColor       = Colors.getColorFromString(bodyTextColor);
            var bodyBackgroundCustomColor = Colors.getColorFromString(bodyBackgroundColor);

            // Get the standard template
            var standardRules = new ThemeRulesStandard();

            ThemeGenerator.InsureSlots(standardRules, false);

            // Set the custom colors to the template
            ThemeGenerator.SetSlot(standardRules[BaseSlots.primaryColor.ToString()], primaryCustomColor);
            ThemeGenerator.SetSlot(standardRules[BaseSlots.foregroundColor.ToString()], bodyTextCustomColor);
            ThemeGenerator.SetSlot(standardRules[BaseSlots.backgroundColor.ToString()], bodyBackgroundCustomColor);

            // Get the JSON string
            String json = ThemeGenerator.GetThemeAsJson(standardRules);

            return(json);
        }
Пример #7
0
 static ThemeGenerator()
 {
     Current = new ThemeGenerator();
 }