Space Engineers

Katt a képre
  • RoboKutya78
    #2875
    Ilyen a játék programnyelve úgy hogy ez szerintem jó lesz így
    Bár ahogy nézem lesz benne probléma a megjelenítésnél Vagy csak az olvasásnál folynak össze a sorok
    SPOILER! Kattints ide a szöveg elolvasásához!


    void Main(string name){
    IMyInventoryOwner IO = (IMyInventoryOwner)GridTerminalSystem.GetBlockWithName(name);
    IMyInventory I = IO.GetInventory(0);
    List<IMyInventoryItem> items = I.GetItems();
    string[] types = {"Ores","Ingots"};
    string itms = "";
    string status = "ON";
    string damaged = "";
    Color color = new Color(0, 255, 0, 255);

    IMyTerminalBlock tb = GridTerminalSystem.GetBlockWithName(name);
    if (!IO.GetType().Name.Equals("MyCargoContainer"))
    {
    if (I.CurrentVolume == 0)
    {
    tb.GetActionWithName("OnOff_Off").Apply(tb);
    color = new Color(255, 175, 0, 255);
    }
    else
    {
    tb.GetActionWithName("OnOff_On").Apply(tb);
    }
    if (!tb.IsWorking && !IO.GetType().Name.Equals("MyCargoContainer"))
    {
    status = "OFF";
    color = new Color(255, 175, 0, 255);
    }
    }
    if (!tb.IsFunctional)
    damaged = " DAMAGED";
    itms += "\t " + name +" "+ status+damaged+" \n ----------------------------------------------- \n";

    if (IO.GetType().Name.Equals("MyRefinery") || IO.GetType().Name.Equals("MyAssembler"))
    {
    if (IO.GetType().Name.Equals("MyAssembler")) { types[0] = types[1]; types[1] = "Items"; }
    itms += types[0]+":\n";
    itms += " Volume: " + ((int)(float.Parse(I.CurrentVolume.ToString()) / float.Parse(I.MaxVolume.ToString()) * 100)) + "%\n";
    for (int j = 0; j < items.Count; j++)
    {
    itms += " "+items[j].Content.SubtypeName + " " + items[j].Amount + "\n";
    }
    itms += "\n" + types[1] + ":\n";
    itms += " Volume: " + ((int)(float.Parse(IO.GetInventory(1).CurrentVolume.ToString()) / float.Parse(IO.GetInventory(1).MaxVolume.ToString()) * 100)) + "%\n";
    List<IMyInventoryItem> itemss = IO.GetInventory(1).GetItems();
    for (int j = 0; j < itemss.Count; j++)
    {
    itms += " "+itemss[j].Content.SubtypeName + " " + itemss[j].Amount + "\n";
    }
    }
    else
    {
    itms += "Volume: " + ((int)(float.Parse(I.CurrentVolume.ToString()) / float.Parse(I.MaxVolume.ToString()) * 100)) + "%\n";
    for (int j = 0; j < items.Count; j++)
    {
    itms += items[j].Content.SubtypeName + " " + items[j].Amount + "\n";
    }
    }
    List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
    blocks.Clear();
    GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(blocks);
    for (int i = 0; i < blocks.Count; i++){
    IMyTextPanel panel = (IMyTextPanel)blocks[i];
    if (panel.CustomName.Equals(name + " Panel")){
    panel.WritePublicText("", false);
    panel.WritePublicText(itms, true);
    }
    }

    if (I.IsFull)
    color = new Color(255, 0, 0, 255);
    GridTerminalSystem.GetBlocksOfType<IMyInteriorLight>(blocks, ((IMyTerminalBlock x) => x.CustomName.Contains(name + " Light")));
    for (int i = 0; i < blocks.Count; i++)
    {
    IMyInteriorLight light = (IMyInteriorLight)blocks[i];
    light.SetValue("Color", color);
    }
    }


    Utoljára szerkesztette: RoboKutya78, 2016.02.13. 12:28:01