Esempio n. 1
0
        public static void GenerateOutputFields(FrontEndTranslator translator, ShaderType shaderType, ShaderInterfaceSet interfaceSet, ShaderBlock declarationBlock, ShaderBlock decorationsBlock)
        {
            if (interfaceSet.Fields.Count == 0)
            {
                return;
            }

            var outputsName = shaderType.mMeta.mName + "_Outputs";

            EntryPointGenerationShared.GenerateInterfaceGlobalFields(translator, interfaceSet.Fields, outputsName, "Out", StorageClass.Output);
            foreach (var inputField in interfaceSet)
            {
                var fieldOp = interfaceSet.GetFieldInstance(translator, inputField, null);
                declarationBlock.mLocalVariables.Add(fieldOp);
            }
            Decorations.LocationCallback locationCallback = (ShaderField field, out int location, out int component) =>
            {
                location = component = -1;
                var attribute = field.mMeta.mAttributes.FindFirstAttribute(typeof(Shader.StageOutput));
                if (attribute == null)
                {
                    return(false);
                }
                var parsedAttribute = AttributeExtensions.ParseStageOutput(attribute);
                location  = parsedAttribute.Location;
                component = parsedAttribute.Component;
                return(false);
            };
            Decorations.AddDecorationLocations(translator, shaderType, interfaceSet, locationCallback, decorationsBlock);
        }
        private async void CodeEditorLoaded()
        {
            _initialized = true;

            if (Decorations != null && Decorations.Count > 0)
            {
                // Need to retrigger highlights after load if they were set before load.
                await DeltaDecorationsHelperAsync(Decorations.ToArray());
            }

            // Now we're done loading
            Loading?.Invoke(this, new RoutedEventArgs());

            // Make sure inner editor is focused
            await SendScriptAsync("editor.focus();");

            // If we're supposed to have focus, make sure we try and refocus on our now loaded webview.
            if (FocusManager.GetFocusedElement() == this)
            {
                _view.Focus(FocusState.Programmatic);
            }

            IsEditorLoaded = true;

            Loaded?.Invoke(this, new RoutedEventArgs());
        }
        protected void initializeGame()
        {
            // initialize background music
            backgroundMusic = defaultBackgroundMusic;
            gameVolume      = 1f;
            PlayBackgroundAudio(backgroundMusic, gameVolume);
            SetTopEchoColor(Color.White);

            theSwitch      = new Switch();
            ballSet        = new BallSet();
            blockSet       = new BlockSet();
            lifeSet        = new LifeSet();
            trapSet        = new TrapSet();
            paddleSet      = new PaddleSet();
            allDecorations = new Decorations();
            allDecorations.initializeBackground();
            GameObjects.debugMode = false;
            GameObjects.score     = 0;
            GameObjects.displayScore();

            totalLife = defaultTotalLife;
            state     = GameState.Normal;

            paddleSet.initialize();
            ballSet.initialize();
            trapSet.initialize();
            blockSet.initialize();
            lifeSet.initialize();

            allDecorations.initializeForeground();
            initialize();
        }
        public void AddDecoration(Decoration decoration)
        {
            if (decoration == null)
            {
                throw new ArgumentException($"Decoration cannot be empty", nameof(decoration));
            }

            Decorations.Add(decoration);
        }
Esempio n. 5
0
 protected TileBase(TextureMap <TileType> tileTextures, TextureMap <DecorationType> decorTextures, Decorations decorations, SpriteBatch spriteBatch, Random rand)
 {
     _tileTextures  = tileTextures;
     _decorTextures = decorTextures;
     _spriteBatch   = spriteBatch;
     _rand          = rand;
     _decorations   = decorations;
     Obstacle       = false;
 }
Esempio n. 6
0
        protected override void OnTextChanged(TextChangedEventArgs e)
        {
            base.OnTextChanged(e);
            Decorations.Clear();

            if (!textChangedEnable)
            {
                return;
            }
            if (isPasted)
            {
                isPasted = false; return;
            }
            foreach (var change in e.Changes)
            {
                if (popup.IsOpen)
                {
                    for (int i = 0; i < change.AddedLength; i++)
                    {
                        if (!char.IsLetterOrDigit(Text, change.Offset + i))
                        {
                            popup.IsOpen = false;
                            return;
                        }
                    }
                }
                if (!popup.IsOpen &&
                    change.AddedLength > 0 &&
                    (change.Offset <= 0 ||
                     !char.IsLetterOrDigit(Text, change.Offset - 1)))
                {
                    popup.Input  = string.Empty;
                    popup.Offset = change.Offset;
                    popup.IsOpen = true;
                    popup.ListBox.SelectedIndex = 0;
                    FixPopupPosition(change.Offset);
                }
            }
            if (popup.IsOpen)
            {
                int inputlast;
                for (inputlast = popup.Offset; inputlast < Text.Length && char.IsLetterOrDigit(Text[inputlast]); inputlast++)
                {
                    ;
                }
                if (inputlast > popup.Offset)
                {
                    popup.Input = Text.Substring(popup.Offset, inputlast - popup.Offset);
                }
                else
                {
                    popup.IsOpen = false;
                }
            }
        }
        private async void CodeEditorLoaded()
        {
            if (Decorations != null && Decorations.Count > 0)
            {
                // Need to retrigger highlights after load if they were set before load.
                await DeltaDecorationsHelperAsync(Decorations.ToArray());
            }

            // Now we're done loading
            Loading?.Invoke(this, new RoutedEventArgs());
        }
Esempio n. 8
0
    public override bool Equals(object other)
    {
        Decorations d_other = other as Decorations;

        if (d_other == null)
        {
            return(false);
        }
        else
        {
            return(d_other.ID == ID);
        }
    }
Esempio n. 9
0
        public ActiveDecoration CreateDecoration(Player owner, string nativeName, Tile target, TagSynergy[] armor, string visualization, float?z, int?health, float?mod)
        {
            if (target.TempObject != null)
            {
                return(null);
            }

            ActiveDecoration decoration = new ActiveDecoration(this, owner, target, visualization, z, health, armor, NativeManager.GetDecorationNative(nativeName), mod);

            Decorations.Add(decoration);
            target.ChangeTempObject(decoration, true);
            return(decoration);
        }
Esempio n. 10
0
        public static ShaderOp GenerateOutputBlockStruct(FrontEndTranslator translator, ShaderType shaderType, ShaderInterfaceSet interfaceSet, ShaderBlock declarationBlock, ShaderBlock decorationsBlock)
        {
            var instanceOp = GenerateOutputStruct(translator, shaderType, interfaceSet, declarationBlock, decorationsBlock);

            if (instanceOp == null)
            {
                return(null);
            }

            var instanceType = instanceOp.mResultType.GetDereferenceType();

            Decorations.AddDecorationBlock(translator, instanceType, decorationsBlock);
            return(instanceOp);
        }
Esempio n. 11
0
        /// <summary>
        /// Gets a decoration description
        /// </summary>
        /// <param name="id">Decoration number</param>
        /// <returns>Decoration information or null</returns>
        public Decoration GetDecoration(int id)
        {
            if (Decorations == null || id == -1)
            {
                return(null);
            }

            if (!Decorations.ContainsKey(id))
            {
                return(null);
            }

            return(Decorations[id]);
        }
Esempio n. 12
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var flores = new Floristeria
            {
                Id   = Guid.NewGuid(),
                Name = FlorisName.Text
            };

            if (flores.Check1(flores.Name))
            {
                DbContext.context.tiendas.Add(flores.Id, flores.Name);
                var arboles = new Arbol
                {
                    Id     = Guid.NewGuid(),
                    Name   = FlorisName.Text,
                    Height = Int32.Parse(TreeSize.Text),
                    Price  = Int32.Parse(TreePrice.Text)
                };
                DbContext.context.arbol.Add(arboles.Id, arboles);
                var flor = new Flor
                {
                    Id    = Guid.NewGuid(),
                    Name  = FlorisName.Text,
                    Color = FlowerColor.Text,
                    Price = Int32.Parse(FlowerPrice.Text)
                };
                DbContext.context.flor.Add(flor.Id, flor);
                var decoration = new Decorations
                {
                    Id       = Guid.NewGuid(),
                    Name     = FlorisName.Text,
                    Material = Decoration.Text,
                    Price    = Int32.Parse(DecoPrice.Text)
                };
                DbContext.context.decorations.Add(decoration.Id, decoration);
                int TiendasCount = DbContext.context.tiendas.Count;
                int suma         = 0;
                foreach (var i in DbContext.context.arbol.Values)
                {
                    suma = suma + i.Price;
                }
                NumTiendas.Content = TiendasCount;
                TotalEuros.Content = suma;
            }
            else
            {
                MessageBox.Show("Ya existe una tienda con ese nommbre");
            }
        }
Esempio n. 13
0
        public TileMap(TextureMap <TileType> textures, TextureMap <DecorationType> decorTextures, Decorations decorations, SpriteBatch spriteBatch, Container container, Config config, Random rand, Generator.MapGenerationConfig mapGenConfig)
        {
            _textures      = textures;
            _spriteBatch   = spriteBatch;
            _decorTextures = decorTextures;
            _decorations   = decorations;
            _mapGenConfig  = mapGenConfig;

            _width     = config.MapWidth;
            _height    = config.MapWidth;
            _container = container;
            _rand      = rand;

            Generate();
        }
Esempio n. 14
0
        public static ShaderOp GenerateOutputStruct(FrontEndTranslator translator, ShaderType shaderType, ShaderInterfaceSet interfaceSet, ShaderBlock declarationBlock, ShaderBlock decorationsBlock)
        {
            if (interfaceSet.Fields.Count == 0)
            {
                return(null);
            }

            var typeName     = shaderType.mMeta.TypeName.CloneAsAppended("_Outputs");
            var instanceName = "Out";
            var instanceOp   = EntryPointGenerationShared.GenerateInterfaceStructAndOp(translator, interfaceSet.Fields, typeName, instanceName, StorageClass.Output);

            Decorations.AddDecorationLocation(translator, instanceOp, 0, decorationsBlock);
            declarationBlock.mLocalVariables.Add(instanceOp);
            return(instanceOp);
        }
Esempio n. 15
0
        public void WriteXml(XmlWriter writer)
        {
            TypeConverter ffc = TypeDescriptor.GetConverter(typeof(FontFamily));
            TypeConverter fsc = TypeDescriptor.GetConverter(typeof(FontStyle));
            TypeConverter fwc = TypeDescriptor.GetConverter(typeof(FontWeight));
            TypeConverter rc  = TypeDescriptor.GetConverter(typeof(Rect));

            writer.WriteElementString("FontFamily", ffc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontFamily));
            writer.WriteElementString("FontStyle", fsc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontStyle));
            writer.WriteElementString("FontWeight", fwc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontWeight));
            writer.WriteElementString("FontSize", FontSize.ToString(CultureInfo.InvariantCulture));

            writer.WriteElementString("HorizontalAlignment", HorizontalAlignment.ToString());
            writer.WriteElementString("VerticalAlignment", VerticalAlignment.ToString());

            writer.WriteStartElement("Padding");
            writer.WriteElementString("Left", PaddingLeft.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("Top", PaddingTop.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("Right", PaddingRight.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("Bottom", PaddingBottom.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            if (Decorations.HasFlag(Helios.TextDecorations.Underline))
            {
                writer.WriteStartElement("Underline");
                writer.WriteEndElement();
            }

            if (Decorations.HasFlag(Helios.TextDecorations.Strikethrough))
            {
                writer.WriteStartElement("Strikethrough");
                writer.WriteEndElement();
            }

            if (Decorations.HasFlag(Helios.TextDecorations.Baseline))
            {
                writer.WriteStartElement("Baseline");
                writer.WriteEndElement();
            }

            if (Decorations.HasFlag(Helios.TextDecorations.OverLine))
            {
                writer.WriteStartElement("OverLine");
                writer.WriteEndElement();
            }
        }
Esempio n. 16
0
        public Entity CreateDecoration(IRectangle hitBox)
        {
            var body = _physics.CreateBody(new BoxCollider(hitBox),
                                           new PhysicalMaterial
            {
                Absorption        = 0.1,
                Restoring         = 0.5,
                Viscosity         = 0.1,
                Density           = 690,
                Friction          = 0.1,
                MovementEmitter   = false,
                MovementRecipient = false,
            });
            var entity = new Entity(this, body);

            Decorations.Add(entity);
            return(entity);
        }
Esempio n. 17
0
        public void RemoveEntity(Entity entity)
        {
            entity.RemoveBody();

            if (entity is Monster monster)
            {
                Enemies.Remove(monster);
            }
            if (Blocks.Contains(entity))
            {
                Blocks.Remove(entity);
            }
            if (Particles.Contains(entity))
            {
                Particles.Remove(entity as Particle);
            }
            Decorations.Remove(entity);
        }
Esempio n. 18
0
        private ForExternalUse.Synchronization.ISynchronizer GetSynchronizationData(bool nullify)
        {
            List <Actor>            changedActors      = Actors.FindAll(x => x.Affected);
            List <ActiveDecoration> changedDecorations = Decorations.FindAll(x => x.Affected);
            List <SpecEffect>       changedEffects     = SpecEffects.FindAll(x => x.Affected);
            List <Tile>             changedTiles       = new List <Tile>();

            for (int x = 0; x < Tiles.Length; x++)
            {
                for (int y = 0; y < Tiles[x].Length; y++)
                {
                    if (Tiles[x][y].Affected)
                    {
                        changedTiles.Add(Tiles[x][y]);
                    }
                }
            }

            Synchronizer sync = new Synchronizer(
                TempTileObject,
                players,
                changedActors,
                changedDecorations,
                changedEffects,
                DeletedActors,
                DeletedDecorations,
                DeletedEffects,
                new Point(Tiles.Length, Tiles[0].Length),
                changedTiles,
                RandomCounter);

            if (nullify)
            {
                changedActors.ForEach(x => x.Affected = false);
                changedDecorations.ToList().ForEach(x => x.Affected = false);
                changedEffects.ToList().ForEach(x => x.Affected     = false);
                changedTiles.ToList().ForEach(x => x.Affected       = false);
                this.DeletedDecorations = new List <ActiveDecoration>();
                this.DeletedActors      = new List <Actor>();
                this.DeletedEffects     = new List <SpecEffect>();
            }

            return(sync);
        }
Esempio n. 19
0
        private TimeSpan CalculateTimeToMake()
        {
            TimeSpan ts = new TimeSpan(0, 0, 0);

            switch (CakeShape)
            {
            case "8\" Round":
                ts = ts.Add(new TimeSpan(1, 0, 0));
                break;

            case "10\" Round":
                ts = ts.Add(new TimeSpan(1, 0, 0));
                break;

            case "12\" x 12\" Square":
                ts = ts.Add(new TimeSpan(1, 15, 0));
                break;

            case "12\" x 24\" Rectangle":
                ts = ts.Add(new TimeSpan(2, 0, 0));
                break;

            default:
                break;
            }

            if (Decorations.Any(d => d.StartsWith("Writing")))
            {
                ts = ts.Add(new TimeSpan(0, Decorations.First(d => d.StartsWith("Writing")).Split(':')[1].Length * 2, 0));
            }

            if (Decorations.Any(d => d.StartsWith("Drawing")))
            {
                ts = ts.Add(new TimeSpan(0, 15, 0));
            }

            if (Decorations.Any(d => d.StartsWith("Photo")))
            {
                ts = ts.Add(new TimeSpan(0, 20, 0));
            }

            return(ts);
        }
Esempio n. 20
0
        public static Decorations GetDecorations()
        {
            var decorations = new Decorations();

            foreach (var t in typeof(TileType).GetMembers())
            {
                var attrs = t.GetCustomAttributes(typeof(DecorationAttribute), false);
                if (attrs != null && attrs.Any())
                {
                    var variant = (TileType)Enum.Parse(typeof(TileType), t.Name);
                    decorations.Add(variant, new List <DecorationAttribute>());
                    foreach (var attr in attrs.Cast <DecorationAttribute>())
                    {
                        decorations[variant].Add(attr);
                    }
                }
            }
            return(decorations);
        }
Esempio n. 21
0
    public void Paint()
    {
        foreach (var room in Rooms)
        {
            room.Paint(this);
            room.PaintDoors(this);
            room.Decorate(this);
        }
        var stairsLoc = Exit.StairsLocation;

        if (stairsLoc != null)
        {
            Decorations.SetTile(new Vector3Int(stairsLoc.Value.x, stairsLoc.Value.y, 0), Painter.LadderDown);
        }
        else
        {
            Debug.LogError("Exit doesn't have valid space for stairs down. This is very bad");
        }
    }
Esempio n. 22
0
        private void AfterActionUpdate()
        {
            foreach (Player player in players)
            {
                if (player.Status == PlayerStatus.Playing && DefeatCondition(this, player))
                {
                    player.Defeat(false);
                }
            }

            for (int i = 0; i < Actors.Count; i++)
            {
                if (!Actors[i].IsAlive)
                {
                    Actors[i].TempTile.RemoveTempObject();
                    DeletedActors.Add(Actors[i]);
                    Actors.RemoveAt(i);
                    i--;
                }
            }

            for (int i = 0; i < Decorations.Count; i++)
            {
                if (!Decorations[i].IsAlive)
                {
                    Decorations[i].TempTile.RemoveTempObject();
                    DeletedDecorations.Add(Decorations[i]);
                    Decorations.RemoveAt(i);
                    i--;
                }
            }

            for (int i = 0; i < SpecEffects.Count; i++)
            {
                if (!SpecEffects[i].IsAlive)
                {
                    DeletedEffects.Add(SpecEffects[i]);
                    SpecEffects.RemoveAt(i);
                    i--;
                }
            }
        }
Esempio n. 23
0
    void Start()
    {
        mRaycastHits = new RaycastHit[NumberOfRaycastHits];
        mMap         = GetComponentInChildren <Environment>();
        Character.setCharacterType(1);

        //Setting up gameobjects
        paddockProfile = GameObject.Find("PaddockStats");
        actionSprite   = GameObject.Find("Sprite");
        profile        = GameObject.Find("DogStats");
        deletionScreen = GameObject.Find("PaddockDeletion");

        //Setting up gameobjects with the appropriate scripts
        paddockHandle = GameObject.Find("PaddockHandler").GetComponent <PaddockHandler>();
        dog           = GameObject.Find("DogHandler").GetComponent <DogHandler>();
        environment   = GameObject.Find("Environment").GetComponent <Environment>();
        cam           = GameObject.Find("MainCamera").GetComponent <CameraScript>();
        currency      = GameObject.Find("Currency").GetComponent <PlayerCurrency>();
        park          = GameObject.Find("ParkHandler").GetComponent <Park>();
        vis           = GameObject.Find("VisitorHandler").GetComponent <VisitorHandler>();
        decorations   = GameObject.Find("Decoration").GetComponent <Decorations>();
        events        = GameObject.Find("Event").GetComponent <Events>();
        level         = GameObject.Find("Levelling").GetComponent <LevelExp>();

        //Set up the paddock colour - darker green than the tiles
        paddockColor = new Color32(60, 107, 62, 1);
        actionSprite.SetActive(false);

        //Three seperate colours for grass - used for when deleting paths
        grassColours.Add(new Color32(98, 214, 164, 1));
        grassColours.Add(new Color32(122, 221, 159, 1));
        grassColours.Add(new Color32(105, 229, 140, 1));

        pauseScreen.SetActive(false);
        tutorialScreen.SetActive(false);
        deletionScreen.SetActive(false);

        ShowMenu(true);
    }
Esempio n. 24
0
        private void Stock_Click(object sender, RoutedEventArgs e)
        {
            var arboles = new Arbol
            {
                Id     = Guid.NewGuid(),
                Name   = FlorisName.Text,
                Height = Int32.Parse(TreeSize.Text),
                Price  = Int32.Parse(TreePrice.Text)
            };

            DbContext.context.arbol.Add(arboles.Id, arboles);
            var flor = new Flor
            {
                Id    = Guid.NewGuid(),
                Name  = FlorisName.Text,
                Color = FlowerColor.Text,
                Price = Int32.Parse(FlowerPrice.Text)
            };

            DbContext.context.flor.Add(flor.Id, flor);
            var decoration = new Decorations
            {
                Id       = Guid.NewGuid(),
                Name     = FlorisName.Text,
                Material = Decoration.Text,
                Price    = Int32.Parse(DecoPrice.Text)
            };

            DbContext.context.decorations.Add(decoration.Id, decoration);
            int TiendasCount = DbContext.context.tiendas.Count;
            int suma         = 0;

            foreach (var i in DbContext.context.arbol.Values)
            {
                suma = suma + i.Price;
            }
            NumTiendas.Content = TiendasCount;
            TotalEuros.Content = suma;
        }
Esempio n. 25
0
        private ForExternalUse.Synchronization.ISynchronizer GetFullSynchronizationData(bool nullify)
        {
            if (nullify)
            {
                Actors.ForEach(x => x.Affected = false);
                Decorations.ToList().ForEach(x => x.Affected = false);
                SpecEffects.ToList().ForEach(x => x.Affected = false);
                for (int x = 0; x < Tiles.Length; x++)
                {
                    for (int y = 0; y < Tiles[x].Length; y++)
                    {
                        Tiles[x][y].Affected = false;
                    }
                }

                this.DeletedDecorations.Clear();
                this.DeletedActors.Clear();
                this.DeletedEffects.Clear();
            }

            return(new SynchronizerFull(TempTileObject, players, Actors, Decorations, SpecEffects, Tiles, RandomCounter));
        }
Esempio n. 26
0
File: Tile.cs Progetto: evad1n/TBoS
        /// <summary>
        /// Randomly generates tile decorations.
        /// </summary>
        public void GenerateDecorations()
        {
            //Determine whether a decoration spawns
            switch (ID)
            {
            //Ground tiles spawn grasses, rocks, and vines where applicable.
            case 1:
            case 3:
            case 4:
            case 5:
                //If this tile has nothing above it, have a chance to spawn a grass or rock.
                if (Adjacents[0] == false)
                {
                    if (Game1.RandomObject.Next(10) <= 3)
                    {
                        Decorations.Add(new TileDecoration(new Rectangle(Rect.X, Rect.Y - (Rect.Height - Rect.Height / Game1.TILE_PIXEL_SIZE), Rect.Width, Rect.Height), 0));
                    }
                }

                //If this tile has nothing under it, have a chance to spawn a vine.
                if (Adjacents[3] == false)
                {
                    if (Game1.RandomObject.Next(10) <= 1)
                    {
                        Decorations.Add(new TileDecoration(new Rectangle(Rect.X, Rect.Y + (Rect.Height - Rect.Height / Game1.TILE_PIXEL_SIZE), Rect.Width, Rect.Height), 1));
                    }
                }

                //If this tile has something above, below, and to either side, have a chance to spawn a different stone texture.
                if (Adjacents[0] && Adjacents[1] && Adjacents[2] && Adjacents[3] && ID != 3)
                {
                    if (Game1.RandomObject.Next(10) <= 1)
                    {
                        Decorations.Add(new TileDecoration(new Rectangle(Rect.X, Rect.Y, Rect.Width, Rect.Height), 4));
                    }
                }

                if (ID == 3)
                {
                    if (Game1.RandomObject.Next(10) == 0)
                    {
                        Decorations.Add(new TileDecoration(new Rectangle(Rect.X, Rect.Y, Rect.Width, Rect.Height), 5));
                    }
                }
                break;

            //Background tiles spawn rocky bits and rough bottoms where applicable.
            case 2:
                //Have a chance to spawn middle roughness.
                if (Game1.RandomObject.Next(10) == 0)
                {
                    Decorations.Add(new TileDecoration(Rect, 2));
                }

                //If there's nothing below this tile, have a chance to spawn bottom roughness.
                if (Adjacents[3] == false)
                {
                    if (Game1.RandomObject.Next(10) <= 1)
                    {
                        Decorations.Add(new TileDecoration(new Rectangle(Rect.X, Rect.Y + (Rect.Height - Rect.Height / Game1.TILE_PIXEL_SIZE), Rect.Width, Rect.Height), 3));
                    }
                }
                break;
            }
        }
Esempio n. 27
0
        public CobblestoneTile(TextureMap <TileType> tileTextures, TextureMap <DecorationType> decorTextures, Decorations decorations, SpriteBatch spriteBatch, Random rand)
            : base(tileTextures, decorTextures, decorations, spriteBatch, rand)
        {
            TileType = TileType.Stone;
            Obstacle = true;

            int variation = rand.Next(-COLOR_VARIANCE, COLOR_VARIANCE);

            SpriteColor = new Color(44 + variation, 51 + variation, 42 + variation);
        }
Esempio n. 28
0
        private List <Ingredient> CreateIngredientList()
        {
            List <Ingredient> l = new List <Ingredient>();

            switch (CakeShape)
            {
            case "8\" Round":
                l.Add(new Ingredient("Flour", 2, "Cups"));
                l.Add(new Ingredient("Sugar", 2, "Cups"));
                l.Add(new Ingredient("Eggs", 2, "Each"));
                l.Add(new Ingredient("Butter", 2, "Tablespoons"));
                l.Add(new Ingredient("Baking Soda", 1, "Teaspoons"));
                break;

            case "10\" Round":
                l.Add(new Ingredient("Flour", 2.5, "Cups"));
                l.Add(new Ingredient("Sugar", 2, "Cups"));
                l.Add(new Ingredient("Eggs", 2, "Each"));
                l.Add(new Ingredient("Butter", 2, "Tablespoons"));
                l.Add(new Ingredient("Baking Soda", 1.5, "Teaspoons"));
                break;

            case "12\" x 12\" Square":
                l.Add(new Ingredient("Flour", 3, "Cups"));
                l.Add(new Ingredient("Sugar", 3, "Cups"));
                l.Add(new Ingredient("Eggs", 3, "Each"));
                l.Add(new Ingredient("Butter", 3, "Tablespoons"));
                l.Add(new Ingredient("Baking Soda", 2, "Teaspoons"));
                break;

            case "12\" x 24\" Rectangle":
                l.Add(new Ingredient("Flour", 6, "Cups"));
                l.Add(new Ingredient("Sugar", 5, "Cups"));
                l.Add(new Ingredient("Eggs", 6, "Each"));
                l.Add(new Ingredient("Butter", 6, "Tablespoons"));
                l.Add(new Ingredient("Baking Soda", 4, "Teaspoons"));
                break;

            default:
                break;
            }

            foreach (string flavor in Flavors)
            {
                if (flavor == "Chocolate Filling")
                {
                    if (CakeShape.StartsWith("8") || CakeShape.StartsWith("10"))
                    {
                        l.Add(new Ingredient("Chocolate Filling", 1, "Tub"));
                    }
                    else
                    {
                        l.Add(new Ingredient("Chocolate Filling", 2, "Tubs"));
                    }
                }
                if (flavor == "Vanilla Filling")
                {
                    if (CakeShape.StartsWith("8") || CakeShape.StartsWith("10"))
                    {
                        l.Add(new Ingredient("Vanilla Filling", 1, "Tub"));
                    }
                    else
                    {
                        l.Add(new Ingredient("Vanilla Filling", 2, "Tubs"));
                    }
                }
                if (flavor == "Pistachio Filling")
                {
                    if (CakeShape.StartsWith("8") || CakeShape.StartsWith("10"))
                    {
                        l.Add(new Ingredient("Chocolate Filling", 1, "Tub"));
                    }
                    else
                    {
                        l.Add(new Ingredient("Chocolate Filling", 2, "Tubs"));
                    }
                }
                if (flavor == "Chocolate Frosting")
                {
                    if (CakeShape.StartsWith("8") || CakeShape.StartsWith("10"))
                    {
                        l.Add(new Ingredient("Chocolate Frosting", 1, "Tub"));
                    }
                    else
                    {
                        l.Add(new Ingredient("Chocolate Filling", 2, "Tubs"));
                    }
                }
                if (flavor == "Caramel Frosting")
                {
                    if (CakeShape.StartsWith("8") || CakeShape.StartsWith("10"))
                    {
                        l.Add(new Ingredient("Caramel Frosting", 1, "Tub"));
                    }
                    else
                    {
                        l.Add(new Ingredient("Caramel Frosting", 2, "Tubs"));
                    }
                }
                if (flavor == "Bacon-Flavored Frosting")
                {
                    if (CakeShape.StartsWith("8") || CakeShape.StartsWith("10"))
                    {
                        l.Add(new Ingredient("Bacon-Flavored Frosting", 1, "Tub"));
                    }
                    else
                    {
                        l.Add(new Ingredient("Bacon-Flavored Frosting", 2, "Tubs"));
                    }
                }
            }

            if (Decorations.Any(d => d.StartsWith("Writing")) ||
                Decorations.Any(d => d.StartsWith("Drawing")))
            {
                l.Add(new Ingredient("Edible Gel",
                                     1,
                                     "Pouch"));
            }

            if (Decorations.Any(d => d.StartsWith("Candles")))
            {
                l.Add(new Ingredient("Candles",
                                     double.Parse(Decorations.First(d => d.StartsWith("Candles")).Split(':')[1]),
                                     "Each"));
            }

            return(l);
        }
Esempio n. 29
0
        static void Main(string[] args)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            TimeSpan timeSpan = new TimeSpan();

            if (args.Contains("--items") || args.Contains("--all") || args.Length == 0)
            {
                var itemManager = new Items();
                itemManager.GetItemList().Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                Console.WriteLine("\n\nFinished with items! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Reset();
                stopwatch.Start();
            }

            if (args.Contains("--monsters") || args.Contains("--all") || args.Length == 0)
            {
                var monManager = new Monsters();
                Console.WriteLine("Starting monster data retrieval.");
                monManager.GetMonsters().Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                Console.WriteLine("Done with monsters! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Reset();
                stopwatch.Start();
            }

            if (args.Contains("--quests") || args.Contains("--all") || args.Length == 0)
            {
                var questManager = new Quests();
                Console.WriteLine("Starting quest data retrieval.");
                questManager.GetQuests("http://mhgen.kiranico.com/quest/village").Wait();
                questManager.GetQuests("http://mhgen.kiranico.com/quest/guild").Wait();
                questManager.GetQuests("http://mhgen.kiranico.com/quest/arena").Wait();
                questManager.GetQuests("http://mhgen.kiranico.com/quest/training").Wait();
                questManager.GetQuests("http://mhgen.kiranico.com/quest/special-permit").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                Console.WriteLine("Done with all quests! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Reset();
                stopwatch.Start();
            }

            if (args.Contains("--weapons") || args.Contains("--all") || args.Length == 0)
            {
                Stopwatch indiv_weapon_watch = new Stopwatch();
                var       weaponManager      = new Weapons();
                string[]  weaponurls         = new string[] {
                    "heavybowgun",
                    "lightbowgun",
                    "bow",
                    "gunlance",
                    "chargeblade",
                    "switchaxe",
                    "huntinghorn",
                    "dualblades",
                    "greatsword",
                    "longsword",
                    "swordshield",
                    "hammer",
                    "lance",
                    "insectglaive"
                };
                indiv_weapon_watch.Start();
                foreach (string category in weaponurls)
                {
                    ConsoleWriters.InfoMessage($"Starting {category} retrieval...");
                    weaponManager.GetWeapons($"http://mhgen.kiranico.com/{category}").Wait();
                    timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(indiv_weapon_watch.Elapsed.TotalSeconds));
                    ConsoleWriters.InfoMessage($"Done with {category}s! Took {timeSpan.ToString("c")}.\n\n");
                    indiv_weapon_watch.Restart();
                }
                indiv_weapon_watch.Stop();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all weapons! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--skills") || args.Contains("--all") || args.Length == 0)
            {
                var skillManager = new Skills();
                ConsoleWriters.InfoMessage("Starting skill retrieval...\n\n");
                skillManager.GetSkills("http://mhgen.kiranico.com/skill").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all skills! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--arts") || args.Contains("--all") || args.Length == 0)
            {
                var artManager = new HunterArts();
                ConsoleWriters.InfoMessage("Starting hunter art retrieval...\n\n");
                artManager.GetArts("http://mhgen.kiranico.com/hunter-art").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all hunter arts! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--decorations") || args.Contains("--all") || args.Length == 0)
            {
                var decoManager = new Decorations();
                ConsoleWriters.InfoMessage("Starting decoration retrieval...\n\n");
                decoManager.GetDecorations("http://mhgen.kiranico.com/decoration").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all decorations! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--armor") || args.Contains("--all") || args.Length == 0)
            {
                var armor = new Armors();
                for (int i = 1; i < 9; i++)
                {
                    armor.GetArmors($"http://mhgen.kiranico.com/armor?rare={i}").Wait();
                }
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all armors! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--palico-skills") || args.Contains("--all") || args.Length == 0)
            {
                var palico = new Palicoes();
                ConsoleWriters.StartingPageMessage("Starting palico skill retrieval...\n\n");
                palico.GetPalicoSkills("http://mhgen.kiranico.com/palico-skill").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all palico skills! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--palico-armor") || args.Contains("--all") || args.Length == 0)
            {
                var palico = new Palicoes();
                ConsoleWriters.StartingPageMessage("Starting palico armor retrieval...\n\n");
                for (int i = 1; i < 5; i++)
                {
                    palico.GetPalicoArmors($"http://mhgen.kiranico.com/palico-armor?page={i}").Wait();
                }
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all palico armors! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }

            if (args.Contains("--palico-weapons") || args.Contains("--all") || args.Length == 0)
            {
                var palico = new Palicoes();
                ConsoleWriters.StartingPageMessage("Starting palico weapon retrieval...\n\n");
                palico.GetPalicoWeapons("http://mhgen.kiranico.com/palico-weapon").Wait();
                timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(stopwatch.Elapsed.TotalSeconds));
                ConsoleWriters.InfoMessage("Done with all palico weapons! Took " + timeSpan.ToString("c") + ".\n\n");
                stopwatch.Restart();
            }
            stopwatch.Stop();
        }
Esempio n. 30
0
 public void ClearAllTiles()
 {
     Terrain.ClearAllTiles();
     Decorations.ClearAllTiles();
 }