Ejemplo n.º 1
0
	public EnumResultBuilder (string name, NamespaceBuilder ns, CodeLinePragma loc, TypeAttributes attr)
	{
	    if (name == null)
		throw new ArgumentNullException ();
	    
	    enumer = new TheEnum (name, ns, loc, attr);
	    result = new TheResult (name + "Result", ns, name, loc, attr);
	}
Ejemplo n.º 2
0
        public EnumResultBuilder(string name, NamespaceBuilder ns, CodeLinePragma loc, TypeAttributes attr)
        {
            if (name == null)
            {
                throw new ArgumentNullException();
            }

            enumer = new TheEnum(name, ns, loc, attr);
            result = new TheResult(name + "Result", ns, name, loc, attr);
        }
Ejemplo n.º 3
0
    private Color EnumToColor(TheEnum colorOnly)
    {
        switch (colorOnly)
        {
        case TheEnum.red: { return(Color.red); }

        case TheEnum.blue: { return(Color.blue); }

        case TheEnum.green: { return(Color.green); }

        default: { Debug.LogWarning("I should of been given a colour as an Enum but I got " + colorOnly); return(Color.white); }
        }
    }
        public void ResolvesConstantValueTypeServicesCorrectly(ServiceLifetime lifetime)
        {
            var serviceCollection = new ServiceCollection();

            if (lifetime == ServiceLifetime.Transient)
            {
                serviceCollection.AddTransient(typeof(int), _ => 4);
                serviceCollection.AddTransient(typeof(DateTime), _ => new DateTime());
                serviceCollection.AddTransient(typeof(TheEnum), _ => TheEnum.HelloWorld);

                serviceCollection.AddTransient(typeof(TimeSpan), _ => TimeSpan.Zero);
                serviceCollection.AddTransient(typeof(TimeSpan), _ => new TimeSpan(1, 2, 3));
            }
            else if (lifetime == ServiceLifetime.Scoped)
            {
                serviceCollection.AddScoped(typeof(int), _ => 4);
                serviceCollection.AddScoped(typeof(DateTime), _ => new DateTime());
                serviceCollection.AddScoped(typeof(TheEnum), _ => TheEnum.HelloWorld);

                serviceCollection.AddScoped(typeof(TimeSpan), _ => TimeSpan.Zero);
                serviceCollection.AddScoped(typeof(TimeSpan), _ => new TimeSpan(1, 2, 3));
            }
            else if (lifetime == ServiceLifetime.Singleton)
            {
                serviceCollection.AddSingleton(typeof(int), 4);
                serviceCollection.AddSingleton(typeof(DateTime), new DateTime());
                serviceCollection.AddSingleton(typeof(TheEnum), TheEnum.HelloWorld);

                serviceCollection.AddSingleton(typeof(TimeSpan), TimeSpan.Zero);
                serviceCollection.AddSingleton(typeof(TimeSpan), _ => new TimeSpan(1, 2, 3));
            }

            var provider = CreateServiceProvider(serviceCollection);

            int i = provider.GetService <int>();

            Assert.Equal(4, i);

            DateTime d = provider.GetService <DateTime>();

            Assert.Equal(new DateTime(), d);

            TheEnum e = provider.GetService <TheEnum>();

            Assert.Equal(TheEnum.HelloWorld, e);

            IEnumerable <TimeSpan> times = provider.GetServices <TimeSpan>();

            Assert.Equal(new[] { TimeSpan.Zero, new TimeSpan(1, 2, 3) }, times);
        }
Ejemplo n.º 5
0
    //CreateCompositeRBSoChildrenMoveWithParent();
    private Color getGizmoColor(TheEnum whatsAtLocation)
    {
        switch (whatsAtLocation)
        {
        case TheEnum.red: { return(Color.red); }

        case TheEnum.blue: { return(Color.blue); }

        case TheEnum.green: { return(Color.green); }

        case TheEnum.edge: { return(Color.white); }

        case TheEnum.space: { return(Color.cyan); }


        default: { Debug.LogWarning("I should of been given a Enum but I got " + whatsAtLocation); return(Color.white); }
        }
    }
Ejemplo n.º 6
0
    public void SomeMethodEnum()
    {
        TheEnum state = TheEnum.stBody;

        switch (state)
        {
        case TheEnum.stHeader:
            //do something
            break;

        case TheEnum.stBody:
            break;

        case TheEnum.stFooter:
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
 public string DoAction(TheEnum enumOptionChosen, string valueToPassIn)
 {
     return("Something");
 }
Ejemplo n.º 8
0
 public T Convert(TheEnum theEnum, Base @base)
 {
     return(default(T));
 }
Ejemplo n.º 9
0
 public FacadeBase()
 {
     TheEnum   = TheEnum._1;
     Converter = new BaseToSub <TheEnum, Base, T>(Convert);
 }
Ejemplo n.º 10
0
    //gizmos
    //I dont want this to run until everything else is calculated
    //could have a cororutine in
    //private void OnDrawGizmos()  //constant gizmos

    //a gizmo showing the edge triangle spaces <- needs a rule like the flip one like
    //so if ran the logic that every time you place a triangle you set its edges and they arnt applied or are overwritten
    //if it is a colour
    //just need to add the indexes (not the adjustment) if odd check row+1 row x-1 and column -1


    //the space
    //the colours



//we have gizmos in the wrong place
//will be fixed a bit with world unit fix
//we have wrong assigned colours - because were out 90degrees just uncomment original code and comment new code for apply the array when we rotate game
//maybe due to game being out 90 degrees at moment

    //think it draws per frame
    //may need some help with taking parent rotation
    private void OnDrawGizmos() //Selected() //gizmos when selected
    {
        // Gizmos.DrawWireMesh(); - might be cool to have a mesh too

        //draw cube at the parent origin
        Gizmos.color = Color.white;
        Gizmos.DrawCube(this.transform.position, new Vector3(1, 1, 1) * 2 * gizmoSize); // this should mark the parents 0,0 and centre of mass

        //make a bigger array for surrounding space around the triangle array
        //fill it with space
        gizmoLocations = new TheEnum[(badTriDataTC.GetLength(0) + 2 * gizmoExtension), (badTriDataTC.GetLength(1) + 2 * gizmoExtension)];
        for (int i = 0; i < gizmoLocations.GetLength(0); i++)
        {
            for (int j = 0; j < gizmoLocations.GetLength(1); j++)
            {
                gizmoLocations[i, j] = TheEnum.space;
            }
        }
        // foreach (TheEnum gizmoType in gizmoLocations){ gizmoType = TheEnum.space; } // cant use foreach



        //this section needs checking over with fresh eyes for where gizmoExtension should shouldnt be TODO


        //here i am gonna look through the tri array at the points that will replace me
        //and update my array
        for (int i = gizmoExtension; i < gizmoLocations.GetLength(0) - gizmoExtension; i++)
        {
            for (int j = gizmoExtension; j < gizmoLocations.GetLength(1) - gizmoExtension; j++)

            {
                //apply the color space or edge to the inside of the gizmo array
                gizmoLocations[i, j] = badTriDataTC[i - gizmoExtension, j - gizmoExtension];

                //if it is a color check and apply edge locations
                if ((gizmoLocations[i, j] == TheEnum.red) || (gizmoLocations[i, j] == TheEnum.blue) || (gizmoLocations[i, j] == TheEnum.green))

                {
                    //check the up and down locations
                    //this may fall appart if we havent made the triangles in the right rotation yet

                    //only replace space with an edge not a color
                    // if (gizmoLocations[i, j - 1] == TheEnum.space) { gizmoLocations[i, j - 1] = TheEnum.edge; }
                    // if (gizmoLocations[i, j + 1] == TheEnum.space) { gizmoLocations[i, j + 1] = TheEnum.edge; }

                    if (gizmoLocations[i - 1, j] == TheEnum.space)
                    {
                        gizmoLocations[i - 1, j] = TheEnum.edge;
                    }
                    if (gizmoLocations[i + 1, j] == TheEnum.space)
                    {
                        gizmoLocations[i + 1, j] = TheEnum.edge;
                    }
                    //need to know orientation so know where to look for edges
                    //Im not accounting for gizmoExtension altering this because we cancel it about
                    //if even check forward and vice versa
                    //not taking off extension because its taken away twice so will not effect the even oddness ???
                    //if it is even then check left else right
                    if (!((i + j) % 2 < 0.1f))
                    // if (((i + j) % 2 < 0.1f))
                    {
                        // if (gizmoLocations[i - 1, j] == TheEnum.space) { gizmoLocations[i - 1, j] = TheEnum.edge; }
                        if (gizmoLocations[i, j - 1] == TheEnum.space)
                        {
                            gizmoLocations[i, j - 1] = TheEnum.edge;
                        }
                    }
                    else
                    {
                        // if (gizmoLocations[i + 1, j] == TheEnum.space) { gizmoLocations[i + 1, j] = TheEnum.edge; }
                        if (gizmoLocations[i, j + 1] == TheEnum.space)
                        {
                            gizmoLocations[i, j + 1] = TheEnum.edge;
                        }
                    }
                }
            }
        }


        //this for will place the new array
        for (int i = 0; i < gizmoLocations.GetLength(0); i++)
        {
            for (int j = 0; j < gizmoLocations.GetLength(1); j++)

            {
                //they seem space right but some distance from the origin of parent but so is the tricluster itself
                float myX = (float)i - gizmoExtension;
                float myY = (float)j - gizmoExtension;


                //this makes it relative to this TriCluster Transform but surely can do that in the instantiation
                Vector3 position = new Vector3((myX + this.gameObject.transform.position.x), (myY + this.gameObject.transform.position.y), (this.gameObject.transform.position.z));

                //without the add it doesnt seem to move with parent, so it most constantly draw!
                // Vector3 position = new Vector3((myX), (myY), (this.gameObject.transform.position.z));


                //this scales it but we shouldnt need this because we should set the gamespace right
                float   myXScaled = position.x * scaleMultiplierX;
                float   myYScaled = position.y * scaleMultiplierY;
                Vector3 positionUnorientatedButScaledAndRelative = new Vector3(myXScaled, myYScaled, position.z); //bad nammed put instages

                // if this method isnt run inline should put both in method
                Gizmos.color = getGizmoColor(gizmoLocations[i, j]);
                Gizmos.DrawSphere(positionUnorientatedButScaledAndRelative, gizmoSize);
            }
        }
    }
Ejemplo n.º 11
0
 public Enums()
 {
     TheEnum enumer       = TheEnum.Test;
     var     description  = StaticEnums.MyEnum.Employee.GetDescription();
     var     description2 = enumer.GetDescription();
 }