public DelayedAction(DelayedActionType type, CompSteam CompSteam)
 {
     this.type      = type;
     this.CompSteam = CompSteam;
     position       = CompSteam.parent.Position;
     rotation       = CompSteam.parent.Rotation;
 }
示例#2
0
    public void Update()
    {
        switch (m_Action)
        {
        case DelayedActionType.None:
            return;

        case DelayedActionType.Edit:
            m_Action = DelayedActionType.None;
            BehaveMenu.EditLibrary();
            break;

        case DelayedActionType.BuildDebug:
            m_Action = DelayedActionType.None;
            BehaveMenu.Compile();
            break;

        case DelayedActionType.BuildRelease:
            m_Action = DelayedActionType.None;
            BehaveMenu.CompileRelease();
            break;

        default:
            m_Action = DelayedActionType.None;
            throw new System.ArgumentException("Unknown action type: " + m_Action);
        }
    }
示例#3
0
    public override void OnInspectorGUI()
    {
        Behave.Editor.Resources.VersionBar();

        EditorGUILayout.Separator();

        GUI.enabled = BehaveMenu.ValidateEditLibrary();
        if (GUILayout.Button("Edit library"))
        {
            m_Action = DelayedActionType.Edit;
        }
        GUI.enabled = true;

        EditorGUILayout.Separator();

        GUILayout.BeginHorizontal();
        GUI.enabled = BehaveMenu.ValidateCompile();
        if (GUILayout.Button("Build library debug", GUI.skin.GetStyle("ButtonLeft")))
        {
            m_Action = DelayedActionType.BuildDebug;
        }
        GUI.enabled = BehaveMenu.ValidateCompileRelease();
        if (GUILayout.Button("Build library release", GUI.skin.GetStyle("ButtonRight")))
        {
            m_Action = DelayedActionType.BuildRelease;
        }
        GUI.enabled = true;
        GUILayout.EndHorizontal();
    }
示例#4
0
 public DelayedAction(DelayedActionType type, CompWater CompWater)
 {
     this.type      = type;
     this.CompWater = CompWater;
     position       = CompWater.parent.Position;
     rotation       = CompWater.parent.Rotation;
 }
 public DelayedAction(DelayedActionType type, CompPipe compPipe)
 {
     this.type     = type;
     this.compPipe = compPipe;
     this.position = compPipe.parent.Position;
     this.rotation = compPipe.parent.Rotation;
 }
	public override void OnInspectorGUI ()
	{
		Behave.Editor.Resources.VersionBar ();

		EditorGUILayout.Separator ();
		
		GUI.enabled = BehaveMenu.ValidateEditLibrary ();
		if (GUILayout.Button ("Edit library"))
		{
			m_Action = DelayedActionType.Edit;
		}
		GUI.enabled = true;
		
		EditorGUILayout.Separator ();
		
		GUILayout.BeginHorizontal ();
			GUI.enabled = BehaveMenu.ValidateCompile ();
			if (GUILayout.Button ("Build library debug", GUI.skin.GetStyle ("ButtonLeft")))
			{
				m_Action = DelayedActionType.BuildDebug;
			}
			GUI.enabled = BehaveMenu.ValidateCompileRelease ();
			if (GUILayout.Button ("Build library release", GUI.skin.GetStyle ("ButtonRight")))
			{
				m_Action = DelayedActionType.BuildRelease;
			}
			GUI.enabled = true;
		GUILayout.EndHorizontal ();
		
		EditorGUILayout.Separator ();
		
		LibraryInspector.OnGUI ();
	}
示例#7
0
 public DelayedAction(DelayedActionType type, CompPower compPower)
 {
     this.type      = type;
     this.compPower = compPower;
     position       = compPower.parent.Position;
     rotation       = compPower.parent.Rotation;
 }
	public void Update ()
	{
		switch (m_Action)
		{
			case DelayedActionType.None:
			return;
			case DelayedActionType.Edit:
				m_Action = DelayedActionType.None;
				BehaveMenu.EditLibrary ();
			break;
			case DelayedActionType.BuildDebug:
				m_Action = DelayedActionType.None;
				BehaveMenu.Compile ();
			break;
			case DelayedActionType.BuildRelease:
				m_Action = DelayedActionType.None;
				BehaveMenu.CompileRelease ();
			break;
			default:
				m_Action = DelayedActionType.None;
				throw new System.ArgumentException ("Unknown action type: " + m_Action);
		}
	}
        public void UpdateSteamNetsAndConnections_First()
        {
            int count = delayedActions.Count;

            for (int i = 0; i < count; i++)
            {
                DelayedAction     delayedAction = delayedActions[i];
                DelayedActionType type          = delayedActions[i].type;
                if (type != DelayedActionType.RegisterTransmitter)
                {
                    if (type == DelayedActionType.DeregisterTransmitter)
                    {
                        TryDestroyNetAt(delayedAction.position);
                        SteamConnectionMaker.DisconnectAllFromTransmitterAndSetWantConnect(delayedAction.CompSteam, map);
                        delayedAction.CompSteam.ResetSteamVars();
                    }
                }
                else if (delayedAction.position == delayedAction.CompSteam.parent.Position)
                {
                    ThingWithComps parent = delayedAction.CompSteam.parent;
                    if (map.GetComponent <SteamNetGrid>().TransmittedSteamNetAt(parent.Position) != null)
                    {
                        //Log.Warning(string.Concat("Tried to register trasmitter ", parent, " at ", parent.Position, ", but there is already a power net here. There can't be two transmitters on the same cell."));
                    }
                    delayedAction.CompSteam.SetUpSteamVars();
                    foreach (IntVec3 cell in GenAdj.CellsAdjacentCardinal(parent))
                    {
                        TryDestroyNetAt(cell);
                    }
                }
            }
            for (int j = 0; j < count; j++)
            {
                DelayedAction delayedAction2 = delayedActions[j];
                if ((delayedAction2.type == DelayedActionType.RegisterTransmitter && delayedAction2.position == delayedAction2.CompSteam.parent.Position) || delayedAction2.type == DelayedActionType.DeregisterTransmitter)
                {
                    TryCreateNetAt(delayedAction2.position);
                    foreach (IntVec3 cell2 in GenAdj.CellsAdjacentCardinal(delayedAction2.position, delayedAction2.rotation, delayedAction2.CompSteam.parent.def.size))
                    {
                        TryCreateNetAt(cell2);
                    }
                }
            }
            for (int k = 0; k < count; k++)
            {
                DelayedAction     delayedAction3 = delayedActions[k];
                DelayedActionType type2          = delayedActions[k].type;
                if (type2 != DelayedActionType.RegisterConnector)
                {
                    if (type2 == DelayedActionType.DeregisterConnector)
                    {
                        SteamConnectionMaker.DisconnectFromSteamNet(delayedAction3.CompSteam);
                        delayedAction3.CompSteam.ResetSteamVars();
                    }
                }
                else if (delayedAction3.position == delayedAction3.CompSteam.parent.Position)
                {
                    delayedAction3.CompSteam.SetUpSteamVars();
                    SteamConnectionMaker.TryConnectToAnySteamNet(delayedAction3.CompSteam, null);
                }
            }
            delayedActions.RemoveRange(0, count);
            if (DebugViewSettings.drawPower)
            {
                DrawDebugSteamNets();
            }
        }
        public void UpdatePipeNetsAndConnections_First()
        {
            int count = this.delayedActions.Count;

            for (int i = 0; i < count; i++)
            {
                DelayedAction     delayedAction = this.delayedActions[i];
                DelayedActionType type          = this.delayedActions[i].type;
                if (type != DelayedActionType.RegisterTransmitter)
                {
                    if (type == DelayedActionType.DeregisterTransmitter)
                    {
                        this.TryDestroyNetAt(delayedAction.position);
                        PipeConnectionMaker.DisconnectAllFromTransmitterAndSetWantConnect(delayedAction.compPipe, this.map);
                        delayedAction.compPipe.ResetPowerVars();
                    }
                }
                else if (delayedAction.position == delayedAction.compPipe.parent.Position)
                {
                    ThingWithComps parent = delayedAction.compPipe.parent;
                    if (this.map.GetComponent <PipeNetGrid>().TransmittedPowerNetAt(parent.Position) != null)
                    {
                        /*Log.Warning(string.Concat(new object[]
                         * {
                         *  "Tried to register trasmitter ",
                         *  parent,
                         *  " at ",
                         *  parent.Position,
                         *  ", but there is already a power net here. There can't be two transmitters on the same cell."
                         * }), false);*/
                    }
                    delayedAction.compPipe.SetUpPowerVars();
                    foreach (IntVec3 current in GenAdj.CellsAdjacentCardinal(parent))
                    {
                        this.TryDestroyNetAt(current);
                    }
                }
            }
            for (int j = 0; j < count; j++)
            {
                DelayedAction delayedAction2 = this.delayedActions[j];
                if ((delayedAction2.type == DelayedActionType.RegisterTransmitter && delayedAction2.position == delayedAction2.compPipe.parent.Position) || delayedAction2.type == DelayedActionType.DeregisterTransmitter)
                {
                    this.TryCreateNetAt(delayedAction2.position);
                    foreach (IntVec3 current2 in GenAdj.CellsAdjacentCardinal(delayedAction2.position, delayedAction2.rotation, delayedAction2.compPipe.parent.def.size))
                    {
                        this.TryCreateNetAt(current2);
                    }
                }
            }
            for (int k = 0; k < count; k++)
            {
                DelayedAction     delayedAction3 = this.delayedActions[k];
                DelayedActionType type2          = this.delayedActions[k].type;
                if (type2 != DelayedActionType.RegisterConnector)
                {
                    if (type2 == DelayedActionType.DeregisterConnector)
                    {
                        PipeConnectionMaker.DisconnectFromPowerNet(delayedAction3.compPipe);
                        delayedAction3.compPipe.ResetPowerVars();
                    }
                }
                else if (delayedAction3.position == delayedAction3.compPipe.parent.Position)
                {
                    delayedAction3.compPipe.SetUpPowerVars();
                    PipeConnectionMaker.TryConnectToAnyPowerNet(delayedAction3.compPipe, null);
                }
            }
            this.delayedActions.RemoveRange(0, count);
            if (DebugViewSettings.drawPower)
            {
                this.DrawDebugPowerNets();
            }
        }
示例#11
0
 public DelayedAction(DelayedActionType type, CompSteam steamPower)
 {
     this.type      = type;
     this.steamComp = steamPower;
 }