コード例 #1
0
        private CarpetQuote CreateCarpetQuoteForRoom(Carpet carpet, double width, double length)
        {
            var room        = new Room(width, length);
            var carpetQuote = new CarpetQuote(room, carpet);

            return(carpetQuote);
        }
コード例 #2
0
 void attachCMD(BasePlayer player, string command, string[] args)
 {
     if (!permission.UserHasPermission(player.UserIDString, permissionName))
     {
         player.ChatMessage(msg("No Permission", player.UserIDString));
         return;
     }
     if (users.ContainsKey(player.UserIDString))
     {
         player.ChatMessage(msg("MC End", player.UserIDString));
         Effect.server.Run("assets/prefabs/npc/patrol helicopter/effects/rocket_fire.prefab", player.transform.position);
         Carpet carpet = users[player.UserIDString].GetComponent <Carpet>();
         if (carpet)
         {
             carpet.Destroy();
         }
         BaseEntity ent = users[player.UserIDString];
         users.Remove(player.UserIDString);
         ent.Kill();
     }
     else
     {
         player.ChatMessage(msg("MC start", player.UserIDString));
         Effect.server.Run("assets/prefabs/npc/patrol helicopter/effects/rocket_fire.prefab", player.transform.position);
         BaseEntity ent = GameManager.server.CreateEntity("assets/prefabs/deployable/rug/rug.deployed.prefab", player.transform.position);
         ent.Spawn();
         ent.gameObject.AddComponent <Carpet>().player = player;
         users.Add(player.UserIDString, ent);
     }
 }
コード例 #3
0
ファイル: Car.cs プロジェクト: devnem0y/InternshipGame
    private void Start()
    {
        carController = new CarController(body, wFront, wBack, transform, forceMotor, rotationSpeed);
        carpet        = transform.GetChild(3).transform.GetComponent <Carpet>();

        startPosX = transform.position.x;
    }
コード例 #4
0
        public static void Show()
        {
            #region 找零问题
            {
                double origAmount   = 0.63;//原始总金额
                double toChange     = origAmount;
                double remainAmount = 0.0;
                int[]  coins        = new int[4];//4种面值 1-5-10-25
                MakeChange(origAmount, remainAmount, coins);
            }
            #endregion

            #region  夫曼
            {
                string input;
                Console.Write("请输入一个字符串: ");
                input = Console.ReadLine();
                TreeList treeList = new TreeList(input);
                for (int i = 0; i < input.Length; i++)
                {
                    treeList.AddSign(input[i].ToString());
                }
                treeList.SortTree();
                while (treeList.Length() > 1)
                {
                    treeList.MergeTree();
                }
                TreeList.MakeKey(treeList.RemoveTree(), "");
                string   newStr    = TreeList.Translate(input);
                string[] signTable = treeList.GetSignTable();
                string[] keyTable  = treeList.GetKeyTable();
                for (int i = 0; i <= signTable.Length - 1; i++)
                {
                    Console.WriteLine(signTable[i] + ": " + keyTable[i]);
                }

                Console.WriteLine("The original string is " + input.Length * 16 + " bits long.");
                Console.WriteLine("The new string is " + newStr.Length + " bits long.");
                Console.WriteLine("The coded string looks like this:" + newStr);
            }
            #endregion

            #region MyRegion
            {
                Carpet    c1   = new Carpet("Frieze", 1.75F, 12);
                Carpet    c2   = new Carpet("Saxony", 1.82F, 9);
                Carpet    c3   = new Carpet("Shag", 1.5F, 13);
                Carpet    c4   = new Carpet("Loop", 1.77F, 10);
                ArrayList rugs = new ArrayList();
                rugs.Add(c1);
                rugs.Add(c2);
                rugs.Add(c3);
                rugs.Add(c4);
                rugs.Sort();
                Knapsack k = new Knapsack(25);
                k.FillSack(rugs);
                Console.WriteLine(k.GetItems());
            }
            #endregion
        }
コード例 #5
0
    public static Node <RefNode> BuildRefTree(Carpet rootCarpet, Carpet[] carpets)
    {
        var refTreeRoot = new Node <RefNode>(new RefNode()
        {
            carpetSO = rootCarpet.carpetSO, parentCount = 0
        });

        for (int i = 0; i < carpets.Length; i++)
        {
            var refNode = new Node <RefNode>(
                new RefNode()
            {
                carpetSO      = carpets[i].carpetSO,
                parentCount   = 0,
                correctCarpet = carpets[i].node
            }
                );

            carpets[i].refNode = refNode;

            AddToRefTree(refTreeRoot, refNode);
        }

        return(refTreeRoot);
    }
コード例 #6
0
 public static void Main()
 {
     Carpet aRug = new Carpet();
       aRug.Width = 12;
       aRug.Length = 14;
       Console.Write("The {0} X {1} carpet ", aRug.Width, aRug.Length);
       Console.WriteLine("has an area of {0}", aRug.Area);
       Console.WriteLine("Our motto is: {0}", Carpet.MOTTO);
 }
コード例 #7
0
    static void Main()
    {
        Carpet aRug = new Carpet();

        aRug.Width  = 12;
        aRug.Length = 14;
        Console.Write("The {0} X {1} carpet ", aRug.Width, aRug.Length);
        Console.WriteLine("has an area of {0}", aRug.Area);
        Console.WriteLine("Our motto is: {0}", Carpet.MOTTO);
    }
コード例 #8
0
        public static ObservableCollection <Carpet> Load()
        {
            using (SqlConnection connection = new SqlConnection(ApplicationA.CONNECTION_STRING))
            {
                ObservableCollection <Carpet> carpets = new ObservableCollection <Carpet>();

                connection.Open();

                DataSet dataSet = new DataSet();

                SqlCommand command = connection.CreateCommand();
                command.CommandText = @"Select * From carpet;";

                SqlDataAdapter dataAdapter = new SqlDataAdapter(command);

                try
                {
                    dataAdapter.Fill(dataSet, "carpet");

                    foreach (DataRow row in dataSet.Tables["carpet"].Rows)
                    {
                        int    id     = (int)row["id"];
                        double length = (double)row["c_length"];
                        double width  = (double)row["c_width"];

                        Carpet carpet = new Carpet(id, length, width);

                        carpets.Add(carpet);
                    }
                }
                catch (SqlException e)
                {
                    MessageBox.Show(ApplicationA.DATABASE_ERROR_MESSAGE);
                    ApplicationA.WriteToLog(e.StackTrace);
                }
                catch (InvalidOperationException a)
                {
                    MessageBox.Show(ApplicationA.DATABASE_ERROR_MESSAGE);
                    ApplicationA.WriteToLog(a.StackTrace);
                }
                catch (ArgumentException g)
                {
                    MessageBox.Show(ApplicationA.DATABASE_ERROR_MESSAGE);
                    ApplicationA.WriteToLog(g.StackTrace);
                }
                catch (NullReferenceException n)
                {
                    MessageBox.Show(ApplicationA.DATABASE_ERROR_MESSAGE);
                    MessageBox.Show(n.StackTrace);
                    ApplicationA.WriteToLog(n.StackTrace);
                }

                return(carpets);
            }
        }
コード例 #9
0
    private void Awake()
    {
        levelScreen = FindObjectOfType <LevelScreen>();

        controller = new Controller(1.85f);

        wFront = wheelFront.transform.GetComponent <Wheel>();
        wBack  = wheelBack.transform.GetComponent <Wheel>();

        carpet = FindObjectOfType <Carpet>();
    }
コード例 #10
0
        public void Main()
        {
            var sweeper = new Sweepable();
            var gallery = new ArtExhibit();

            var wallart = new Carpet(sweeper, gallery);

            foreach (var action in wallart.actions)
            {
                action.Action();
            }
        }
コード例 #11
0
ファイル: Carpet.cs プロジェクト: gabrielg9/EscapeRoom
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(transform.gameObject);
     }
     DontDestroyOnLoad(transform.gameObject);
 }
コード例 #12
0
    private void Awake()
    {
        RolledIn = true;

        block = GetComponent <CarpetMPBlock>();

        carpet = GetComponent <Carpet>();

        pitch = block.GetPitch();

        anglePerUnit = block.GetAnglePerUnit();
    }
コード例 #13
0
ファイル: Program.cs プロジェクト: jacob-l/VideoCreator
        private static Scene CreateScene3()
        {
            Size resolution = new Size(640, 480);
            Point3D position = new Point3D(0, 0, 5000);
            double focus = 1000;
            SizeF projectionWindow = new SizeF(200, 150);
            Rotation rotation = new Rotation(-Math.PI * 0.25, 0, -Math.PI / 2.3);
            PerspectiveCamera camera = new PerspectiveCamera(position, rotation, projectionWindow, resolution, focus);

            Scene scene = new Scene();
            scene.Camera = camera;
            scene.InfinityColor = Color.Black;

            Material mS1 = new Material(Color.Green, 0.3, 0.3, 0.6, 0, 5);
            Material mS2 = new Material(Color.Red, 0.4, 0.4, 0, 0.4, 5);
            Material mS3 = new Material(Color.Yellow, 0.4, 0.3, 0.5, 0, 5);
            Material mS4 = new Material(Color.BlueViolet, 0.4, 0.3, 0.4, 0, 5);

            Material mC1 = new Material(Color.Black, 0.3, 0.3, 0.4, 0, 5);
            Material mC2 = new Material(Color.White, 0.3, 0.3, 0.4, 0, 5);

            Carpet carpet = new Carpet(new Point3D(0, 0, 0), new SizeF(5000, 5000), new Size(50, 50), mC1, mC2);
            double r = 100;
            double h = 2 * r * 0.866;
            double x = -h * 0.66 * 0.7;
            //шары в форме пирамиды
            Sphere sphere1 = new Sphere(new Point3D(x, x, r), r, mS1);
            Sphere sphere2 = new Sphere(new Point3D(x + h * 0.7 - r * 0.7, x + h * 0.7 + r * 0.7, r), r, mS2);
            Sphere sphere3 = new Sphere(new Point3D(x + h * 0.7 + r * 0.7, x + h * 0.7 - r * 0.7, r), r, mS3);
            Sphere sphere4 = new Sphere(new Point3D(x + h * 0.7 * 0.66, x + h * 0.7 * 0.66, 2.5 * r), r, mS4);

            scene.AddGraphicsObject(carpet);

            scene.AddGraphicsObject(sphere1);
            scene.AddGraphicsObject(sphere2);
            scene.AddGraphicsObject(sphere3);
            scene.AddGraphicsObject(sphere4);

            Light L1 = new Light(new Point3D(0, 0, 2000), Color.White);
            Light L2 = new Light(new Point3D(0, 2000, 3000), Color.White);
            Light L3 = new Light(new Point3D(2000, 0, 3000), Color.White);
            Light L4 = new Light(new Point3D(0, -2000, 3000), Color.White);
            Light L5 = new Light(new Point3D(-2000, 0, 3000), Color.White);
            //scene.AddLight(L1);
            scene.AddLight(L2);
            scene.AddLight(L3);
            scene.AddLight(L4);
            scene.AddLight(L5);

            return scene;
        }
コード例 #14
0
        public static void Main()
        {
            Carpet aRug = new Carpet();

            aRug.Width - 12;
            aRug.Length = 14;

            Carpet bRug = new Carpet(24, 10);

            Display {
                aRug
            };
            Display(bRug);
        }
コード例 #15
0
    public void FillContent(Carpet carpet)
    {
        Carpet = carpet;
        RectTransform rt = this.GetComponent <RectTransform>();

        rt.sizeDelta = new Vector2(rt.sizeDelta.x, 278);

        ContentText.text = carpet.serial_number;
        if (carpet.avatar != null)
        {
            TextureURL = HostConfig.MainHostUrl + carpet.avatar;
        }
        //TextureURL = HostConfig.HostUrl + "images/abc.png";
        StartCoroutine(DownloadImage(TextureURL));
        Debug.Log(TextureURL);
    }
コード例 #16
0
        public override async Task <ActionResult> HandleAsync([FromBody] CreateCarpetRequest request, CancellationToken cancellationToken = default)
        {
            var Carpet = new Carpet
            {
                Id              = request.Id,
                Name            = request.Name,
                Description     = request.Description,
                Length          = request.Length,
                Width           = request.Width,
                Brand           = request.Brand,
                Style           = request.Style,
                SquareYardPrice = request.SquareYardPrice
            };
            await _repo.AddAsync(Carpet);

            await _repo.SaveAsync();

            return(Ok(Carpet));
        }
コード例 #17
0
    public static Node <Carpet> CreateRootNode()
    {
        Carpet rootCarpet = new Carpet()
        {
            carpetSO = new CarpetSO()
            {
                Order = -1
            }, parents = new List <ParentNode>()
        };

        rootCarpet.carpetSO.Polygon.Add(new Vector2(float.MinValue, float.MinValue));
        rootCarpet.carpetSO.Polygon.Add(new Vector2(float.MinValue, float.MaxValue));
        rootCarpet.carpetSO.Polygon.Add(new Vector2(float.MaxValue, float.MaxValue));
        rootCarpet.carpetSO.Polygon.Add(new Vector2(float.MaxValue, float.MinValue));

        rootCarpet.node = new Node <Carpet>(rootCarpet);

        return(rootCarpet.node);
    }
コード例 #18
0
        //Makes a regular room
        public static Block[,] Room(Random rng, Orientation[] orientations, Orientation enterance)
        {
            Block[,] blocks = Walls();

            //Gets the pattern used for the floor
            int[,] pattern = RoomPattern(rng);

            for (int x = 0; x < 19; ++x)
            {
                for (int y = 0; y < 11; ++y)
                {
                    if (pattern[x, y] == 1)
                    {
                        blocks[1 + x, 1 + y] = new Carpet(new Vector2(1 + x, 1 + y));
                    }
                    else
                    {
                        blocks[1 + x, 1 + y] = new Ground(new Vector2(1 + x, 1 + y));
                    }
                }
            }
            return(blocks);
        }
コード例 #19
0
        public static Block[,] Entrance(Random rng, Orientation[] orientations)
        {
            //Creates the object and all the walls with doors
            Block[,] blocks = Walls();

            //Making all the floor blocks randomising if they are regular floor or carpet
            for (int x = 1; x < 20; ++x)
            {
                for (int y = 1; y < 12; ++y)
                {
                    if (rng.Next(0, 2) != 1)
                    {
                        blocks[x, y] = new Ground(new Vector2(x, y));
                    }
                    else
                    {
                        blocks[x, y] = new Carpet(new Vector2(x, y));
                    }
                }
            }

            blocks[10, 6] = new Staircase(new Vector2(10, 6), true);
            return(blocks);
        }
コード例 #20
0
 private void HandleBeforeRollIn(Carpet carpet)
 {
 }
コード例 #21
0
 public static void Display(Carpet car)
 {
     Console.Write("The {0} x {1} carpet ", car.Width, car.Length);
     Console.WriteLine("has an area of {0}", car.Area);
     Console.WriteLine("Our Motto is: {0}", Carpet.MOTTO) :
 }
コード例 #22
0
        /// <summary>
        /// Determines if a new carpet can be placed at the given point. If a carpet cannot fit because
        /// of Z-index clashes, the Z-index is modified until the carpet can fit.
        /// </summary>
        public bool CanFit(ref Point3D p)
        {
            if (Map == null || Map == Map.Internal || Deleted || Carpet == null || Carpet.Deleted)
            {
                return(false);
            }

            MultiComponentList mcl = MultiData.GetComponents(Carpet.ItemID);
            int topZ = p.Z;

            for (int x = 0; x < mcl.Width; x++)
            {
                for (int y = 0; y < mcl.Height; y++)
                {
                    int tx = (p.X + mcl.Min.X + x);
                    int ty = (p.Y + mcl.Min.Y + y);

                    LandTile     landTile = Map.Tiles.GetLandTile(tx, ty);
                    StaticTile[] statics  = Map.Tiles.GetStaticTiles(tx, ty, true);

                    topZ = Math.Max(topZ, Map.GetAverageZ(tx, ty));

                    for (int i = 0; i < statics.Length; i++)
                    {
                        StaticTile t = statics[i];

                        if (t.Z > p.Z && (p.Z + 12) > t.Z)  //if it's above, and our top would hit its bottom
                        {
                            return(false);
                        }
                        else if (t.Z < p.Z && (t.Z + t.Height) > p.Z)  //if it's below, and its top would hit our bottom
                        {
                            return(false);
                        }
                    }

                    object obj = Map.GetTopSurface(p);

                    if (obj is LandTile)
                    {
                        LandTile t = (LandTile)obj;

                        if (t.Z > p.Z)
                        {
                            return(false);
                        }
                    }
                    else if (obj is StaticTile)
                    {
                        StaticTile t = (StaticTile)obj;

                        if (t.Z > p.Z)
                        {
                            return(false);
                        }
                    }
                    else if (obj is Item)
                    {
                        Item i = obj as Item;

                        if (i.GetWorldTop().Z > p.Z)
                        {
                            return(false);
                        }
                    }

                    if (mcl.Tiles[x][y].Length == 0 || Carpet.Contains(tx, ty))
                    {
                        continue;
                    }

                    if (!Map.CanFit(tx, ty, Z, 12, false, true, false))
                    {
                        return(false);
                    }
                }
            }

            IPooledEnumerable eable = Map.GetItemsInBounds(new Rectangle2D((p.X + mcl.Min.X), (p.Y + mcl.Min.Y), mcl.Width, mcl.Height));

            foreach (Item i in eable)
            {
                if (i.ItemID >= 0x4000 || i.Z < p.Z || !i.Visible)
                {
                    continue;
                }

                int x = (i.X - p.X + mcl.Min.X);
                int y = (i.Y - p.Y + mcl.Min.Y);

                if (x >= 0 && x < mcl.Width && y >= 0 && y < mcl.Height && mcl.Tiles[x][y].Length == 0)
                {
                    continue;
                }
                else if (Carpet.Contains(i))
                {
                    continue;
                }

                eable.Free();
                return(false);
            }

            eable.Free();

            p.Z = topZ + 1;

            return(true);
        }
コード例 #23
0
    private void HandleBeforeRollOut(Carpet carpet)
    {
        AddToTree(carpet);

        carpet.SetY(carpet.GetHeight());
    }
コード例 #24
0
 private void RemoveFromTree(Carpet current)
 {
     current.Unset();
 }
コード例 #25
0
 private void AddToTree(Carpet carpet)
 {
     CurrentTree.obj.AddToTree(carpet.node);
 }
コード例 #26
0
 public async Task AddAsync(Carpet carpet)
 {
     await _context.AddAsync(carpet);
 }
コード例 #27
0
    public void GenerateTree(LevelSO levelSO)
    {
        int n = levelSO.carpetSOs.Count;

        Carpets = new Carpet[n];

        CarpetRollers = new CarpetRoller[n];

        for (int i = 0; i < n; i++)
        {
            Carpets[i] = Instantiate(carpetPrefab, transform).GetComponent <Carpet>().Init(levelSO.carpetSOs[i]);
            Carpets[i].carpetRoller.RollStateChanged += HandleCarpetRollStateChanged;
            Carpets[i].carpetRoller.BeforeRollIn     += HandleBeforeRollIn;
            Carpets[i].carpetRoller.BeforeRollOut    += HandleBeforeRollOut;
            Carpets[i].InGameIndex = -1;
            Carpets[i].carpetMeshCreator.MeshRebuiltCallback += Carpets[i].carpetRoller.HandleCarpetMeshRebuilt;
            Carpets[i].carpetMeshCreator.RebuildMesh();

            CarpetRollers[i] = Carpets[i].carpetRoller;
        }

        RolledOutCounter = 0;

        var rootCarpet = Carpet.CreateRootNode();

        SolutionTree = Carpet.BuildRefTree(rootCarpet.obj, Carpets);

        CurrentTree = rootCarpet;

        float left = float.MaxValue, right = float.MinValue, top = float.MinValue, bottom = float.MaxValue;

        for (int i = 0; i < n; i++)
        {
            var c = Carpets[i];

            c.SetY(c.GetCorrectHeight());

            if (c.carpetMeshCreator.Bounds.x < left)
            {
                left = c.carpetMeshCreator.Bounds.x;
            }
            if (c.carpetMeshCreator.Bounds.y > right)
            {
                right = c.carpetMeshCreator.Bounds.y;
            }
            if (c.carpetMeshCreator.Bounds.z > top)
            {
                top = c.carpetMeshCreator.Bounds.z;
            }
            if (c.carpetMeshCreator.Bounds.w < bottom)
            {
                bottom = c.carpetMeshCreator.Bounds.w;
            }
        }
        Bounds = new Bounds()
        {
            center = new Vector3((left + right) / 2, 0, (top + bottom) / 2),
            size   = new Vector3((right - left), 0, (top - bottom))
        };

        //Carpet.DisplayRefTree(SolutionTree);

        CarpetTreeController.Reset();

        Vector3 origin = /*new Vector3(levelSO.Position.x, 0, levelSO.Position.y)- */ -Bounds.center;

        transform.localPosition = origin + new Vector3(0, transform.localPosition.y, 0);
    }
コード例 #28
0
 public void UpdateCarpet(Carpet carpet)
 {
     _context.Entry(carpet).State = EntityState.Modified;
 }