Beispiel #1
0
        public void AfterEdit(MapperType mapper)
        {
            // We cannot use undo system for PIOs, because they are dymanic
            // trying to save them will result in exception on 'undo' while
            // getting mapper type inside OnEditField
            if (mapper is MCustom <string> )
            {
                BlockMapper.OnEditField(BlockBehaviour, mapper);
            }
            else
            {
                Player localPlayer = Player.GetLocalPlayer();
                if (localPlayer == null || localPlayer.IsHost)
                {
                    return;
                }

                var tempdata = new XDataHolder();
                BlockBehaviour.OnSave(tempdata);
                tempdata.Encode(out byte[] dataBytes);

                var message = ModContext.CpuInfoMessage.CreateMessage(
                    this.BlockBehaviour,
                    dataBytes
                    );
                ModNetworking.SendToHost(message);
            }
        }
Beispiel #2
0
        public override void BuildingUpdate()
        {
            if (Input.GetMouseButton(0) && !InputManager.ToggleSimulationKey())
            {
                return;
            }
            if (BlockMapper.CurrentInstance)
            {
                return;
            }
            bool close = false;

            if (missingSizeSave)
            {
                missingSizeSave = false;
                BlockMapper.OnEditField(Behaviour, size);
                close = true;
            }
            if (missingCorrSave)
            {
                missingCorrSave = false;
                BlockMapper.OnEditField(Behaviour, correction);
                close = true;
            }
            if (close)
            {
                BlockMapper.Close();
            }
        }
Beispiel #3
0
        public virtual void SetCentering(float value)
        {
            correction.SetValue(value);

            if (Input.GetMouseButton(0) && !IsSimulating && !InputManager.ToggleSimulationKey())
            {
                missingCorrSave = true;
                return;
            }
            missingCorrSave = false;
            BlockMapper.OnEditField(Behaviour, correction);
            fakeOpen = true;
        }
Beispiel #4
0
        public virtual void SetSize(float value)
        {
            size.SetValue(value);

            if (Input.GetMouseButton(0) && !IsSimulating && !InputManager.ToggleSimulationKey())
            {
                missingSizeSave = true;
                return;
            }
            missingSizeSave = false;
            BlockMapper.OnEditField(Behaviour, size);
            fakeOpen = true;
        }