Exemplo n.º 1
0
 public virtual TsEnum GetTsEnum(NetEnum netEnum)
 {
     return(new TsEnum
     {
         Enums = netEnum.Enums.Select(GetTsEnumValue).ToList(),
         IsPublic = netEnum.IsPublic,
         Name = netEnum.Name
     });
 }
Exemplo n.º 2
0
        public virtual string WriteEnum(NetEnum netEnum)
        {
            var enumStr   = string.Join("," + _config.NewLine, netEnum.Enums.Select(WriteEnumValue)).Indent(_indent);
            var exportStr = netEnum.IsPublic ? "public " : "";

            return($"{exportStr}enum {netEnum.Name}" + _config.NewLine +
                   @"{" + _config.NewLine +
                   $"{enumStr}" + _config.NewLine +
                   @"}");
        }
Exemplo n.º 3
0
        internal void ResolveEnum(JToken propValue, NetModel.NetModel model)
        {
            var result = new NetEnum();

            var name    = propValue["name"].ToString().Split('.').Last();
            var symbols = (JArray)propValue["symbols"];

            result.Name    = name;
            result.Symbols = symbols.Select(s => s.ToString()).ToList();

            model.NetTypes.Add(result);
        }
Exemplo n.º 4
0
        public static NetEnum GetNetEnum(EnumDeclarationSyntax enumDeclaration)
        {
            var name = enumDeclaration.Identifier.ToString();

            var a = new NetEnum
            {
                Attributes = GetAttributeList(enumDeclaration.AttributeLists),
                IsPublic   = IsPublic(enumDeclaration.Modifiers),
                Name       = name,
                Enums      = GetNetEnumValues(enumDeclaration.Members)
            };

            return(a);
        }
Exemplo n.º 5
0
        public Debris(int debrisType, int numberOfChunks, Vector2 debrisOrigin, Vector2 playerPosition, float velocityMultiplyer)
            : this()
        {
            switch (debrisType)
            {
            case 0:
            case 378:
                debrisType            = 378;
                this.debrisType.Value = DebrisType.RESOURCE;
                break;

            case 2:
            case 380:
                debrisType            = 380;
                this.debrisType.Value = DebrisType.RESOURCE;
                break;

            case 6:
            case 384:
                debrisType            = 384;
                this.debrisType.Value = DebrisType.RESOURCE;
                break;

            case 10:
            case 386:
                debrisType            = 386;
                this.debrisType.Value = DebrisType.RESOURCE;
                break;

            case 4:
            case 382:
                debrisType            = 382;
                this.debrisType.Value = DebrisType.RESOURCE;
                break;

            case 12:
            case 388:
                debrisType            = 388;
                this.debrisType.Value = DebrisType.RESOURCE;
                break;

            case 14:
            case 390:
                debrisType            = 390;
                this.debrisType.Value = DebrisType.RESOURCE;
                break;

            case 8:
                this.debrisType.Value = DebrisType.CHUNKS;
                break;

            default:
                this.debrisType.Value = DebrisType.OBJECT;
                break;
            }
            if (debrisType != -1)
            {
                playerPosition -= (playerPosition - debrisOrigin) * 2f;
            }
            _ = 154;
            chunkType.Value = debrisType;
            int minYVelocity3 = 2;
            int maxYVelocity3 = 10;
            int minXVelocity3 = -10;
            int maxXVelocity3 = 10;

            floppingFish.Value = (Game1.objectInformation.ContainsKey(debrisType) && Game1.objectInformation[debrisType].Split('/')[3].Contains("-4") && !Game1.objectInformation[debrisType].Split('/')[0].Equals("Mussel"));
            isFishable         = (Game1.objectInformation.ContainsKey(debrisType) && Game1.objectInformation[debrisType].Split('/')[3].Contains("Fish"));
            if (playerPosition.Y >= debrisOrigin.Y - 32f && playerPosition.Y <= debrisOrigin.Y + 32f)
            {
                chunkFinalYLevel = (int)debrisOrigin.Y - 32;
                minYVelocity3    = 220;
                maxYVelocity3    = 250;
                if (playerPosition.X < debrisOrigin.X)
                {
                    minXVelocity3 = 20;
                    maxXVelocity3 = 140;
                }
                else
                {
                    minXVelocity3 = -140;
                    maxXVelocity3 = -20;
                }
            }
            else if (playerPosition.Y < debrisOrigin.Y - 32f)
            {
                chunkFinalYLevel = (int)debrisOrigin.Y + (int)(32f * velocityMultiplyer);
                minYVelocity3    = 150;
                maxYVelocity3    = 200;
                minXVelocity3    = -50;
                maxXVelocity3    = 50;
            }
            else
            {
                movingFinalYLevel = true;
                chunkFinalYLevel  = (int)debrisOrigin.Y - 1;
                chunkFinalYTarget = (int)debrisOrigin.Y - (int)(96f * velocityMultiplyer);
                movingUp          = true;
                minYVelocity3     = 350;
                maxYVelocity3     = 400;
                minXVelocity3     = -50;
                maxXVelocity3     = 50;
            }
            debrisOrigin.X -= 32f;
            debrisOrigin.Y -= 32f;
            minXVelocity3   = (int)((float)minXVelocity3 * velocityMultiplyer);
            maxXVelocity3   = (int)((float)maxXVelocity3 * velocityMultiplyer);
            minYVelocity3   = (int)((float)minYVelocity3 * velocityMultiplyer);
            maxYVelocity3   = (int)((float)maxYVelocity3 * velocityMultiplyer);
            for (int i = 0; i < numberOfChunks; i++)
            {
                chunks.Add(new Chunk(debrisOrigin, (float)Game1.recentMultiplayerRandom.Next(minXVelocity3, maxXVelocity3) / 40f, (float)Game1.recentMultiplayerRandom.Next(minYVelocity3, maxYVelocity3) / 40f, Game1.recentMultiplayerRandom.Next(debrisType, debrisType + 2)));
            }
        }