public override bool Init(MyObjectBuilder_ToolbarItem data)
 {
     bool result = base.Init(data);
     ActivateOnClick = false;
     WantsToBeActivated = false;
     return result;
 }
        public override bool Init(MyObjectBuilder_ToolbarItem objBuilder)
        {
            base.Init(objBuilder);

            ActivateOnClick = true;
            WantsToBeActivated = false;
            return true;
        }
Ejemplo n.º 3
0
        public override bool Init(MyObjectBuilder_ToolbarItem data)
        {
            bool init = base.Init(data);
            ActivateOnClick = false;

			var objectBuilder = data as MyObjectBuilder_ToolbarItemWeapon;
			
            return init;
        }
 public override bool Init(MyObjectBuilder_ToolbarItem data)
 {
     bool result = base.Init(data);
     ActivateOnClick = false;
     var cubeDef = Definition as MyCubeBlockDefinition;
     if (result && cubeDef != null && cubeDef.BlockStages != null && cubeDef.BlockStages.Length > 0)
     {
         SetSubIcon(VariantsAvailableSubicon);
     }
     return result;
 }
        public override bool Init(MyObjectBuilder_ToolbarItem data)
        {
            Debug.Assert(data is MyObjectBuilder_ToolbarItemDefinition, "Wrong definition put to toolbar");

            if(MyDefinitionManager.Static.TryGetDefinition(((MyObjectBuilder_ToolbarItemDefinition)data).DefinitionId, out Definition))
            {
                if (!Definition.Public && !Sandbox.Engine.Utils.MyFakes.ENABLE_NON_PUBLIC_BLOCKS)
                {
                    return false;
                }
                SetDisplayName(Definition.DisplayNameText);
                SetIcon(Definition.Icon);
                return true;
            }
            return false;
        }
        public override bool Init(MyObjectBuilder_ToolbarItem data)
        {
            bool init = base.Init(data);
            ActivateOnClick = false;

			var objectBuilder = data as MyObjectBuilder_ToolbarItemWeapon;
			if (objectBuilder != null)
			{
				m_isDeconstructor = objectBuilder.IsDeconstructor;
				if (m_isDeconstructor)
				{
					SetDisplayName(DisplayName.Append(" Deconstructor").ToString());
					var split = Icon.Split(new char[] { '_' });	// MK: TODO: Change icon properly.
					SetIcon(split[0] + "_Deconstruction.dds");
				}
			}

            return init;
        }
        public override bool Init(MyObjectBuilder_ToolbarItem objBuilder)
        {
            Debug.Assert(objBuilder is MyObjectBuilder_ToolbarItemTerminalGroup, "Wrong object builder in toolbar");

            WantsToBeActivated = false;
            WantsToBeSelected = false;

            var builder = (MyObjectBuilder_ToolbarItemTerminalGroup)objBuilder;
            SetDisplayName(builder.GroupName);
            if (builder.BlockEntityId == 0)
            {
                m_wasValid = false;
                return false;
            }
            this.m_blockEntityId = builder.BlockEntityId;
            this.m_groupName = new StringBuilder(builder.GroupName);
            m_wasValid = true;
            SetAction(builder.Action);
            return true;
        }
Ejemplo n.º 8
0
        private void SetItemAtSerialized(int i, string serializedItem, MyObjectBuilder_ToolbarItem data)
        {
            if (!m_items.IsValidIndex(i))
                return;

            //old saves
            if (data == null)
            {
                if (String.IsNullOrEmpty(serializedItem))
                    return;

                var split = serializedItem.Split(':');
                MyObjectBuilderType typeId;

                if (!MyObjectBuilderType.TryParse(split[0], out typeId))
                    return;

                string subtypeString = (split.Length == 2) ? split[1] : null;
                var defId = new MyDefinitionId(typeId, subtypeString);

                SetItemAtSerializedCompat(i, defId);
            }

            //new saves
            else
                SetItemAtIndexInternal(i, MyToolbarItemFactory.CreateToolbarItem(data), true);
        }
Ejemplo n.º 9
0
        public void SetItemAtIndex(int i, MyDefinitionId defId, MyObjectBuilder_ToolbarItem data)
        {
            if (!m_items.IsValidIndex(i))
                return;

            MyDefinitionBase definition;
            if (MyDefinitionManager.Static.TryGetDefinition(defId, out definition))
                SetItemAtIndex(i, MyToolbarItemFactory.CreateToolbarItem(data));
        }
Ejemplo n.º 10
0
 public override bool Init(MyObjectBuilder_ToolbarItem data)
 {
     base.Init(data);
     ActivateOnClick = false;
     return true;
 }
Ejemplo n.º 11
0
		public static void RequestChangeSlotItem(PlayerId pid, int index, MyObjectBuilder_ToolbarItem itemBuilder)
		{
			var msg = new PlayerToolbarChangeSlotBuilderMsg();
			msg.ClientSteamId = pid.SteamId;
			msg.PlayerSerialId = pid.SerialId;
			msg.Index = index;
			msg.itemBuilder = itemBuilder;

			Sync.Layer.SendMessageToServer(ref msg);
		}
        public override bool Init(MyObjectBuilder_ToolbarItem objectBuilder)
        {
            Debug.Assert(objectBuilder is MyObjectBuilder_ToolbarItemTerminalBlock, "Wrong definition put to toolbar");

            WantsToBeActivated = false;
            WantsToBeSelected = false;
            ActivateOnClick = true;

            m_block = null;

            var builder = (MyObjectBuilder_ToolbarItemTerminalBlock)objectBuilder;
            m_blockEntityId = builder.BlockEntityId;
            if (m_blockEntityId == 0)
            {
                m_wasValid = false;
                return false;
            }
            TryGetBlock();
            SetAction(builder.Action);

            if (builder.Parameters != null && builder.Parameters.Count > 0)
            {
                m_parameters.Clear();
                foreach (var item in builder.Parameters)
                {
                    m_parameters.Add(TerminalActionParameter.Deserialize(item.Value, item.TypeCode));
                }
            }
            return true;
        }
Ejemplo n.º 13
0
 public override bool Init(MyObjectBuilder_ToolbarItem data)
 {
     return true;
 }
 public static MyToolbarItem CreateToolbarItem(MyObjectBuilder_ToolbarItem data)
 {
     MyToolbarItem item = m_objectFactory.CreateInstance(data.TypeId);
     return item.Init(data) ? item : null;
 }
Ejemplo n.º 15
0
 public abstract bool Init(MyObjectBuilder_ToolbarItem data);