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


C# Helpers.MyToolbar类代码示例

本文整理汇总了C#中Sandbox.Game.Screens.Helpers.MyToolbar的典型用法代码示例。如果您正苦于以下问题:C# MyToolbar类的具体用法?C# MyToolbar怎么用?C# MyToolbar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyToolbar类属于Sandbox.Game.Screens.Helpers命名空间,在下文中一共展示了MyToolbar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MyControllableSphere

        public MyControllableSphere()
        {
            ControllerInfo.ControlAcquired += OnControlAcquired;
            ControllerInfo.ControlReleased += OnControlReleased;

            m_toolbar = new MyToolbar(ToolbarType);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyControllableSphere.cs

示例2: OnRemoving

        public override void OnRemoving()
        {
            MyToolbarComponent.CurrentToolbarChanged -= ToolbarComponent_CurrentToolbarChanged;
            if (m_shownToolbar != null)
            {
                m_shownToolbar.ItemChanged -= Toolbar_ItemChanged;
                m_shownToolbar.ItemUpdated -= Toolbar_ItemUpdated;
                m_shownToolbar.SelectedSlotChanged -= Toolbar_SelectedSlotChanged;
                m_shownToolbar.SlotActivated -= Toolbar_SlotActivated;
                m_shownToolbar.ItemEnabledChanged -= Toolbar_ItemEnabledChanged;
                m_shownToolbar.CurrentPageChanged -= Toolbar_CurrentPageChanged;
                m_shownToolbar = null;
            }

            base.OnRemoving();
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:16,代码来源:MyGuiControlToolbar.cs

示例3: CurrentToolbar_SlotActivated

		private void CurrentToolbar_SlotActivated(MyToolbar toolbar, MyToolbar.SlotArgs args)
		{
			if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemAreaMarker))
				AreaMarkerDefinition = null;
		}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:5,代码来源:MyPlaceAreas.cs

示例4: Toolbar_ItemChanged

 void Toolbar_ItemChanged(MyToolbar toolbar, MyToolbar.IndexArgs index)
 {
     var item = toolbar.GetItemAtIndex(index.ItemIndex);
     if (item != null)
     {
         var def = item as MyToolbarItemDefinition;
         if (def != null)
         {
             var defId = def.Definition.Id;
             if (defId != null)
             {
                 if (defId.TypeId != typeof(MyObjectBuilder_PhysicalGunObject))
                     MyToolBarCollection.RequestChangeSlotItem(MySession.Static.LocalHumanPlayer.Id, index.ItemIndex, defId);
                 else
                     MyToolBarCollection.RequestChangeSlotItem(MySession.Static.LocalHumanPlayer.Id, index.ItemIndex, item.GetObjectBuilder());
             }
         }
     }
     else if (MySandboxGame.IsGameReady)
     {
         MyToolBarCollection.RequestClearSlot(MySession.Static.LocalHumanPlayer.Id, index.ItemIndex);
     }
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:23,代码来源:MyCharacter.cs

示例5: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            SyncFlag = true;

            var sinkComp = new MyResourceSinkComponent();
            sinkComp.Init(
                BlockDefinition.ResourceSinkGroup,
                BlockDefinition.RequiredPowerInput,
                this.CalculateRequiredPowerInput);
            ResourceSink = sinkComp;

            base.Init(objectBuilder, cubeGrid);

            m_items = new List<ToolbarItem>(2);
            for (int i = 0; i < 2; i++)
            {
                m_items.Add(new ToolbarItem() { EntityID = 0 });
            }
            Toolbar = new MyToolbar(MyToolbarType.ButtonPanel, 2, 1);
            Toolbar.DrawNumbers = false;

            var builder = (MyObjectBuilder_SensorBlock)objectBuilder;
            
            m_fieldMin.Value = Vector3.Clamp(builder.FieldMin, new Vector3(-MaxRange), -Vector3.One);
            m_fieldMax.Value = Vector3.Clamp(builder.FieldMax, Vector3.One, new Vector3(MaxRange));

            PlayProximitySound = builder.PlaySound;
            DetectPlayers = builder.DetectPlayers;
            DetectFloatingObjects = builder.DetectFloatingObjects;
            DetectSmallShips = builder.DetectSmallShips;
            DetectLargeShips = builder.DetectLargeShips;
            DetectStations = builder.DetectStations;
            DetectAsteroids = builder.DetectAsteroids;
            DetectOwner = builder.DetectOwner;
            DetectFriendly = builder.DetectFriendly;
            DetectNeutral = builder.DetectNeutral;
            DetectEnemy = builder.DetectEnemy;
            m_active.Value = builder.IsActive;

            Toolbar.Init(builder.Toolbar, this);

            for (int i = 0; i < 2; i++)
            {
                var item = Toolbar.GetItemAtIndex(i);
                if (item == null)
                    continue;
                m_items.RemoveAt(i);
                m_items.Insert(i, ToolbarItem.FromItem(item));
            }
            Toolbar.ItemChanged += Toolbar_ItemChanged;

            NeedsUpdate |= MyEntityUpdateEnum.EACH_10TH_FRAME;

            SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged;

			
			ResourceSink.IsPoweredChanged += Receiver_IsPoweredChanged;
			ResourceSink.RequiredInputChanged += Receiver_RequiredInputChanged;
			ResourceSink.Update();

            m_fieldShape = GetHkShape();

            OnClose += delegate(MyEntity self)
            {
                m_fieldShape.RemoveReference();
            };

            m_gizmoColor = MySandboxGame.IsDirectX11 ? new Vector4(0.35f, 0, 0, 0.5f) : new Vector4(0.1f, 0, 0, 0.1f);

        }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:70,代码来源:MySensorBlock.cs

示例6: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            SyncFlag = true; 
            var sinkComp = new MyResourceSinkComponent();
            sinkComp.Init(
                BlockDefinition.ResourceSinkGroup,
                m_powerNeeded,
                this.CalculateRequiredPowerInput);

           
            ResourceSink = sinkComp;
            base.Init(objectBuilder, cubeGrid);
            NeedsUpdate = MyEntityUpdateEnum.BEFORE_NEXT_FRAME | MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.EACH_10TH_FRAME;

            var remoteOb = (MyObjectBuilder_RemoteControl)objectBuilder;
            m_savedPreviousControlledEntityId = remoteOb.PreviousControlledEntityId;

            sinkComp.IsPoweredChanged += Receiver_IsPoweredChanged;
            sinkComp.RequiredInputChanged += Receiver_RequiredInputChanged;
			
            sinkComp.Update();

            m_autoPilotEnabled.Value = remoteOb.AutoPilotEnabled;
            m_dockingModeEnabled.Value = remoteOb.DockingModeEnabled;
            m_currentFlightMode.Value = (FlightMode)remoteOb.FlightMode;
            m_currentDirection.Value = (Base6Directions.Direction)remoteOb.Direction;
            m_autopilotSpeedLimit.Value = remoteOb.AutopilotSpeedLimit;
            m_bindedCamera.Value = remoteOb.BindedCamera;
            m_waypointThresholdDistance.Value = remoteOb.WaypointThresholdDistance;
            m_currentAutopilotSpeedLimit = m_autopilotSpeedLimit;

            m_stuckDetection = new MyStuckDetection(0.03f, 0.01f, this.CubeGrid.PositionComp.WorldAABB);

            if (remoteOb.Coords == null || remoteOb.Coords.Count == 0)
            {
                if (remoteOb.Waypoints == null)
                {
                    m_waypoints = new List<MyAutopilotWaypoint>();
                    CurrentWaypoint = null;
                }
                else
                {
                    m_waypoints = new List<MyAutopilotWaypoint>(remoteOb.Waypoints.Count);
                    for (int i = 0; i < remoteOb.Waypoints.Count; i++)
                    {
                        m_waypoints.Add(new MyAutopilotWaypoint(remoteOb.Waypoints[i], this));
                    }
                }
            }
            else
            {
                m_waypoints = new List<MyAutopilotWaypoint>(remoteOb.Coords.Count);
                for (int i = 0; i < remoteOb.Coords.Count; i++)
                {
                    m_waypoints.Add(new MyAutopilotWaypoint(remoteOb.Coords[i], remoteOb.Names[i], this));
                }

                if (remoteOb.AutoPilotToolbar != null && m_currentFlightMode == FlightMode.OneWay)
                {
                    m_waypoints[m_waypoints.Count - 1].SetActions(remoteOb.AutoPilotToolbar.Slots);
                }
            }

            if (remoteOb.CurrentWaypointIndex == -1 || remoteOb.CurrentWaypointIndex >= m_waypoints.Count)
            {
                CurrentWaypoint = null;
            }
            else
            {
                CurrentWaypoint = m_waypoints[remoteOb.CurrentWaypointIndex];
            }

            UpdatePlanetWaypointInfo();

            m_actionToolbar = new MyToolbar(MyToolbarType.ButtonPanel, pageCount: 1);
            m_actionToolbar.DrawNumbers = false;
            m_actionToolbar.Init(null, this);

            m_selectedGpsLocations = new List<IMyGps>();
            m_selectedWaypoints = new List<MyAutopilotWaypoint>();
            UpdateText();

            AddDebugRenderComponent(new MyDebugRenderComponentRemoteControl(this));

            m_useCollisionAvoidance.Value = remoteOb.CollisionAvoidance;

            for (int i = 0; i < TERRAIN_HEIGHT_DETECTION_SAMPLES; i++)
            {
                m_terrainHeightDetection[i] = 0.0f;
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:91,代码来源:MyRemoteControl.cs

示例7: Toolbar_ItemChanged

 private void Toolbar_ItemChanged(MyToolbar self, MyToolbar.IndexArgs index)
 {
     if (m_syncing)
     {
         return;
     }
     MyMultiplayer.RaiseEvent(this,x => x.SendToolbarItemChanged,ToolbarItem.FromItem(self.GetItemAtIndex(index.ItemIndex)), index.ItemIndex);
 }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:8,代码来源:MyAirVent.cs

示例8: SetToToolbar

 public void SetToToolbar(MyToolbar toolbar, int index)
 {
     var item = m_cachedItem;
     if (item != null)
         toolbar.SetItemAtIndex(index, item);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:6,代码来源:ToolbarItemCache.cs

示例9: SetupPlayer

        private static void SetupPlayer(ref Args args)
        {
            var identity = Sync.Players.CreateNewIdentity(Sync.Clients.LocalClient.DisplayName);
            var player = Sync.Players.CreateNewPlayer(identity, Sync.Clients.LocalClient, Sync.MyName);
            var playerStarts = args.Scenario.PossiblePlayerStarts;
            if (playerStarts == null || playerStarts.Length == 0)
            {
                Sync.Players.RespawnComponent.SetupCharacterDefault(player, args);
            }
            else
            {
                var randomStart = playerStarts[MyUtils.GetRandomInt(playerStarts.Length)];
                randomStart.SetupCharacter(args);
            }

            // Setup toolbar
            if (args.Scenario.DefaultToolbar != null)
            {
                // TODO: JakubD fix this
                MyToolbar toolbar = new MyToolbar(MyToolbarType.Character);
                toolbar.Init(args.Scenario.DefaultToolbar, player.Character, true);

                MySession.Static.Toolbars.RemovePlayerToolbar(player.Id);
                MySession.Static.Toolbars.AddPlayerToolbar(player.Id, toolbar);
                MyToolbarComponent.InitToolbar(MyToolbarType.Character, args.Scenario.DefaultToolbar);
                MyToolbarComponent.InitCharacterToolbar(args.Scenario.DefaultToolbar);
            }
        }
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:28,代码来源:MyWorldGenerator.cs

示例10: CurrentToolbar_Unselected

 private void CurrentToolbar_Unselected(MyToolbar toolbar)
 {
     BotToSpawn = null;
     CommandDefinition = null;
 }
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:5,代码来源:MyAIComponent.cs

示例11: CurrentToolbar_SlotActivated

 private void CurrentToolbar_SlotActivated(MyToolbar toolbar, MyToolbar.SlotArgs args)
 {
     if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemBot))
         BotToSpawn = null;
     if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemAiCommand))
         CommandDefinition = null;
 }
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:7,代码来源:MyAIComponent.cs

示例12: CurrentToolbar_SelectedSlotChanged

 private void CurrentToolbar_SelectedSlotChanged(MyToolbar toolbar, MyToolbar.SlotArgs args)
 {
     if (!(toolbar.SelectedItem is MyToolbarItemBot))
         BotToSpawn = null;
     if (!(toolbar.SelectedItem is MyToolbarItemAiCommand))
         CommandDefinition = null;
 }
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:7,代码来源:MyAIComponent.cs

示例13: CreateDefaultToolbar

 private void CreateDefaultToolbar(PlayerId playerId)
 {
     if (ContainsToolbar(playerId))
         return;
     var toolbar = new MyToolbar(MyToolbarType.Character);
     toolbar.Init(MySession.Static.Scenario.DefaultToolbar, null, true);
     AddPlayerToolbar(playerId, toolbar);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:8,代码来源:MyToolbarCollection.cs

示例14: LoadToolbars

 public void LoadToolbars(MyObjectBuilder_Checkpoint checkpoint)
 {
     if (checkpoint.AllPlayersData != null)
     {
         foreach (var item in checkpoint.AllPlayersData.Dictionary)
         {
             var playerId = new PlayerId(item.Key.ClientId, item.Key.SerialId);
             var toolbar = new MyToolbar(MyToolbarType.Character);
             toolbar.Init(item.Value.Toolbar, null, true);
             AddPlayerToolbar(playerId, toolbar);
         }
     }
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:13,代码来源:MyToolbarCollection.cs

示例15: AddPlayerToolbar

        public bool AddPlayerToolbar(PlayerId pid, MyToolbar toolbar)
        {

            if (pid == null || toolbar == null)
                return false;

            MyToolbar result;
            var success = m_playerToolbars.TryGetValue(pid, out result);

            if (!success)
            {
                m_playerToolbars.Add(pid, toolbar);
                return true;
            }
            else 
            {
                return false;
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:19,代码来源:MyToolbarCollection.cs


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