当前位置: 首页>>代码示例>>C#>>正文


C# Route.Add方法代码示例

本文整理汇总了C#中Route.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Route.Add方法的具体用法?C# Route.Add怎么用?C# Route.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Route的用法示例。


在下文中一共展示了Route.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getMovementFor

    private MovementManager getMovementFor(Train train, bool isLocalTrain, NetworkTrainPlayer networkPlayer, GuiPlayersPointsElement playersPoints, NetworkEntityPlaying network)
    {
        float rotationSpeed = train.RotationSpeed;
        float translationSpeed = train.TranslationSpeed * GameMapSizeFactor.GetFactorForCurrentMapRelativeToFirstMap();
        int maxPassengers = train.MaxPassengers;
        Transform mover = train.transform.parent ?? train.transform;

        TransformOperations.To(mover).SetRotationTo(FirstStation.transform.position);

        Route route = new Route();
        route.Add(null);
        route.Add(FirstStation);

        if (isLocalTrain) {
            FirstStation.StartHighlight();
        }

        Player player = networkPlayer == null ? PlayerFactory.CreateLocal(train) : networkPlayer;

        TrainPassengersLimit trainPassengersLimit = TrainPassengersLimitFactory.Get(TrainPassengersLimitType);
        trainPassengersLimit.SetLimit(maxPassengers);
        TrainPassengers passengers = new TrainPassengers(trainPassengersLimit, player);

        TimeCounter timeCounter = new TimeCounter();
        timeCounters.Add(timeCounter);

        CurrentPoints points = new CurrentPoints(CurrentMap.GetCurrentMap(), passengers, timeCounter);
        playersPoints.AddPoints(player, points);

        GuiButtonRendererControl backToMenuButton = null;
        GuiButtonRendererControl showRankingButton = null;

        Movement firstMovement, normalMovement, goOutMovement;
        if (isLocalTrain) {
            Camera camera = Camera.main;
            Vector3 cameraOffset = -(mover.position - camera.transform.position);

            firstMovement = new ParallelMovement()
                .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationStartStepType, TERRESTRIAL))
                .AddMovement(new TranslationMovement(camera.transform, translationSpeed, TranslationStartStepType, TERRESTRIAL, cameraOffset));
            //firstMovement.Update(FirstStation.transform.position);

            normalMovement = new SequentialMovement()
                .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL))
                .AddMovement(new ParallelMovement()
                    .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL))
                    .AddMovement(new TranslationMovement(camera.transform, translationSpeed, TranslationDefaultStepType, TERRESTRIAL, cameraOffset)));

            goOutMovement = new SequentialMovement()
                .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL))
                .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL));

            MapCamera trainCamera = new TrainCamera(Camera.main);
            MapCamera freeCamera = new FreeCamera(Camera.main);
            CameraManager cameraManager = new CameraManager(trainCamera);

            backToMenuButton = new GuiButtonRendererControl(() => Application.LoadLevel(SceneNames.MENU));
            showRankingButton = new GuiButtonRendererControl(() => SocialManager.ForegroundActions.ShowLeaderboard(CurrentMap.GetCurrentMap()));
            GuiButtonRendererControl setTrainCameraButton = new GuiButtonRendererControl(() => cameraManager.SetCamera(trainCamera));
            GuiButtonRendererControl setFreeCameraButton = new GuiButtonRendererControl(() => cameraManager.SetCamera(freeCamera));

            gui.AddElement(new GuiHudElement(passengers, timeCounter));
            gui.AddElement(GuiElementFactory.GetSwitchCameraElement("Train\nCam", GuiPosition.DOWN_LEFT, setTrainCameraButton));
            gui.AddElement(GuiElementFactory.GetSwitchCameraElement("Free\nCam", GuiPosition.DOWN_RIGHT, setFreeCameraButton));

            input.AddLocal(route, cameraManager);
            input.AddButtons(backToMenuButton, showRankingButton, setTrainCameraButton, setFreeCameraButton);
        } else {
            firstMovement = new TranslationMovement(mover, translationSpeed, TranslationStartStepType, TERRESTRIAL);
            //firstMovement.Update(FirstStation.transform.position);

            goOutMovement = normalMovement = new SequentialMovement()
                .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL))
                .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL));

            networkPlayer.SetRoute(route);
        }

        return new MovementManager(FirstStation, LastStation, route, firstMovement, normalMovement, goOutMovement, passengers, timeCounter, points, gui, backToMenuButton, showRankingButton, isLocalTrain, playersPoints, network);
    }
开发者ID:alvarogzp,项目名称:nextation,代码行数:80,代码来源:Main.cs

示例2: _treeView_Expanded

        private void _treeView_Expanded(object sender, RoutedEventArgs e)
        {
            var treeViewItem = e.OriginalSource as TreeViewItem;
            if (treeViewItem == null) return;

            var treeViewModel = (TreeViewModelBase)_treeView.SearchItemFromElement((DependencyObject)treeViewItem);

            var path = new Route();

            foreach (var item in treeViewModel.GetAncestors())
            {
                if (item is SignatureTreeViewModel) path.Add(((SignatureTreeViewModel)item).Value.LinkItem.Signature);
            }

            Settings.Instance.LinkControl_ExpandedPaths.Add(path);
        }
开发者ID:Alliance-Network,项目名称:Amoeba,代码行数:16,代码来源:LinkControl.xaml.cs

示例3: Setting_Init

        private void Setting_Init()
        {
            NativeMethods.SetThreadExecutionState(ExecutionState.SystemRequired | ExecutionState.Continuous);

            {
                bool initFlag = false;

                _amoebaManager = new AmoebaManager(_serviceManager.Config.Cache.Path, _bufferManager);
                _amoebaManager.Load(_configrationDirectoryPaths["AmoebaManager"]);

                if (!File.Exists(Path.Combine(_serviceManager.Paths["Configuration"], "Amoeba.version")))
                {
                    initFlag = true;

                    {
                        var p = new System.Diagnostics.ProcessStartInfo();
                        p.UseShellExecute = true;
                        p.FileName = Path.GetFullPath(Path.Combine(_serviceManager.Paths["Core"], "Amoeba.exe"));
                        p.Arguments = "Relate on";

                        OperatingSystem osInfo = Environment.OSVersion;

                        // Windows Vista以上。
                        if (osInfo.Platform == PlatformID.Win32NT && osInfo.Version >= new Version(6, 0))
                        {
                            p.Verb = "runas";
                        }

                        try
                        {
                            System.Diagnostics.Process.Start(p);
                        }
                        catch (System.ComponentModel.Win32Exception)
                        {

                        }
                    }

                    {
                        // Amoeba
                        Settings.Instance.ChatControl_ChatCategorizeTreeItem.ChatTreeItems.Add(new ChatTreeItem(AmoebaConverter.FromTagString("Tag:AAAABkFtb2ViYQEgyeOUT6BPIlq8Nfe1kndaS0ETNlmJY90wt-Osb-l2mZqamJsU")));
                        // Test
                        Settings.Instance.ChatControl_ChatCategorizeTreeItem.ChatTreeItems.Add(new ChatTreeItem(AmoebaConverter.FromTagString("Tag:AAAABFRlc3QBIMEj2xDMP6_RAoVbePTEZwHz8Fcd29tqB9MY0JZyn6eS5iXI_A")));
                    }

                    {
                        Settings.Instance.Global_SearchKeywords.Clear();
                        Settings.Instance.Global_SearchKeywords.Add("Box");
                        Settings.Instance.Global_SearchKeywords.Add("Picture");
                        Settings.Instance.Global_SearchKeywords.Add("Movie");
                        Settings.Instance.Global_SearchKeywords.Add("Music");
                        Settings.Instance.Global_SearchKeywords.Add("Archive");
                        Settings.Instance.Global_SearchKeywords.Add("Document");
                        Settings.Instance.Global_SearchKeywords.Add("Executable");

                        Settings.Instance.Global_UploadKeywords.Clear();
                        Settings.Instance.Global_UploadKeywords.Add("Document");

                        var pictureSearchItem = new SearchItem() { Name = "Type - \"Picture\"" };
                        pictureSearchItem.SearchNameRegexCollection.Add(new SearchContains<SearchRegex>(true, new SearchRegex(@"\.(jpeg|jpg|jfif|gif|png|bmp)$", true)));

                        var movieSearchItem = new SearchItem() { Name = "Type - \"Movie\"" };
                        movieSearchItem.SearchNameRegexCollection.Add(new SearchContains<SearchRegex>(true, new SearchRegex(@"\.(mpeg|mpg|avi|divx|asf|wmv|rm|ogm|mov|flv|vob)$", true)));

                        var musicSearchItem = new SearchItem() { Name = "Type - \"Music\"" };
                        musicSearchItem.SearchNameRegexCollection.Add(new SearchContains<SearchRegex>(true, new SearchRegex(@"\.(mp3|wma|m4a|ogg|wav|mid|mod|flac|sid)$", true)));

                        var archiveSearchItem = new SearchItem() { Name = "Type - \"Archive\"" };
                        archiveSearchItem.SearchNameRegexCollection.Add(new SearchContains<SearchRegex>(true, new SearchRegex(@"\.(zip|rar|7z|lzh|iso|gz|bz|xz|tar|tgz|tbz|txz)$", true)));

                        var documentSearchItem = new SearchItem() { Name = "Type - \"Document\"" };
                        documentSearchItem.SearchNameRegexCollection.Add(new SearchContains<SearchRegex>(true, new SearchRegex(@"\.(doc|txt|pdf|odt|rtf)$", true)));

                        var executableSearchItem = new SearchItem() { Name = "Type - \"Executable\"" };
                        executableSearchItem.SearchNameRegexCollection.Add(new SearchContains<SearchRegex>(true, new SearchRegex(@"\.(exe|jar|sh|bat)$", true)));

                        Settings.Instance.SearchControl_SearchTreeItem.Children.Clear();
                        Settings.Instance.SearchControl_SearchTreeItem.Children.Add(new SearchTreeItem(pictureSearchItem));
                        Settings.Instance.SearchControl_SearchTreeItem.Children.Add(new SearchTreeItem(movieSearchItem));
                        Settings.Instance.SearchControl_SearchTreeItem.Children.Add(new SearchTreeItem(musicSearchItem));
                        Settings.Instance.SearchControl_SearchTreeItem.Children.Add(new SearchTreeItem(archiveSearchItem));
                        Settings.Instance.SearchControl_SearchTreeItem.Children.Add(new SearchTreeItem(documentSearchItem));
                        Settings.Instance.SearchControl_SearchTreeItem.Children.Add(new SearchTreeItem(executableSearchItem));
                    }

                    {
                        var tempBox = new Box();
                        tempBox.Name = "Temp";

                        var box = new Box();
                        box.Name = "Box";
                        box.Boxes.Add(tempBox);

                        var route = new Route();
                        route.Add(box.Name);

                        Settings.Instance.LibraryControl_Box = box;
                        Settings.Instance.LibraryControl_ExpandedPaths.Add(route);
                    }

//.........这里部分代码省略.........
开发者ID:Alliance-Network,项目名称:Amoeba,代码行数:101,代码来源:MainWindow.xaml.cs


注:本文中的Route.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。