Exemplo n.º 1
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     CollapseButton.onClick.AddListener(ToggleOpen);
     SetColors(colors);
     ArrowIcon.SetActive();
     log          = new LoggerFSS("detailpanel", 35);
     labels       = new Dictionary <string, Label <DetailLabel> >();
     buttonLabels = new Dictionary <string, Label <DetailLabelWithButton> >();
     Commit();
 }
    protected override void OnSpawn()
    {
        base.OnSpawn();
        KPrefabID component = GetComponent <KPrefabID>();

        if ((Object)component != (Object)null)
        {
            log = new LoggerFSS("Door", 35);
        }
        if (!allowAutoControl && controlState == ControlState.Auto)
        {
            controlState = ControlState.Locked;
        }
        StructureTemperatureComponents structureTemperatures = GameComps.StructureTemperatures;

        HandleVector <int> .Handle handle = structureTemperatures.GetHandle(base.gameObject);
        if (DisplacesGas(doorType))
        {
            structureTemperatures.Bypass(handle);
        }
        controller = new Controller.Instance(this);
        controller.StartSM();
        if (doorType == DoorType.Sealed && !hasBeenUnsealed)
        {
            Seal();
        }
        UpdateDoorSpeed(operational.IsOperational);
        Subscribe(-592767678, OnOperationalChangedDelegate);
        Subscribe(824508782, OnOperationalChangedDelegate);
        Subscribe(-801688580, OnLogicValueChangedDelegate);
        requestedState = CurrentState;
        ApplyRequestedControlState(true);
        int num  = (rotatable.GetOrientation() == Orientation.Neutral) ? (building.Def.WidthInCells * (building.Def.HeightInCells - 1)) : 0;
        int num2 = (rotatable.GetOrientation() != 0) ? building.Def.HeightInCells : building.Def.WidthInCells;

        for (int i = 0; i != num2; i++)
        {
            int num3 = building.PlacementCells[num + i];
            Grid.FakeFloor[num3] = true;
            Pathfinding.Instance.AddDirtyNavGridCell(num3);
        }
        List <int> list = new List <int>();

        int[] placementCells = building.PlacementCells;
        foreach (int num4 in placementCells)
        {
            Grid.HasDoor[num4]       = true;
            Grid.HasAccessDoor[num4] = ((Object)GetComponent <AccessControl>() != (Object)null);
            if (rotatable.IsRotated)
            {
                list.Add(Grid.CellAbove(num4));
                list.Add(Grid.CellBelow(num4));
            }
            else
            {
                list.Add(Grid.CellLeft(num4));
                list.Add(Grid.CellRight(num4));
            }
            SimMessages.SetCellProperties(num4, 8);
            if (DisplacesGas(doorType))
            {
                Grid.RenderedByWorld[num4] = false;
            }
        }
    }