コード例 #1
0
            public static void Postfix(BuildingStatusItems __instance)
            {
                // Building cords
                Z.coordinates = new StatusItem("ZCoordinates", "ZTRANSPORT", "",
                                               StatusItem.IconType.Info,
                                               NotificationType.Neutral,
                                               false,
                                               OverlayModes.None.ID);
                Z.coordinates.resolveStringCallback = (str, data) => {
                    int          x, y;
                    ZTransporter transporter = (ZTransporter)data;
                    Grid.CellToXY(Grid.PosToCell(transporter), out x, out y);
                    return(str.Replace("{X}", x.ToString())
                           .Replace("{Y}", y.ToString()));
                };
                __instance.Add(Z.coordinates);


                // Connected status
                Z.notConnected = new StatusItem("ZNotConnected",
                                                "ZTRANSPORT", "",
                                                StatusItem.IconType.Exclamation,
                                                NotificationType.BadMinor,
                                                false,
                                                OverlayModes.None.ID);
                Z.notConnected.resolveStringCallback = (str, data) => {
                    string ererrroroor = (string)data;
                    return(str.Replace("{REASON}", ererrroroor));
                };
                Z.notConnected.AddNotification();
                __instance.Add(Z.notConnected);


                // Drop box sending status
                Z.dropBoxSending = new StatusItem("ZDropBoxStatus",
                                                  "ZTRANSPORT", "",
                                                  StatusItem.IconType.Info,
                                                  NotificationType.Neutral,
                                                  false,
                                                  OverlayModes.None.ID);
                Z.dropBoxSending.resolveStringCallback = (str, data) => {
                    int object_count = (int)data;
                    return(str.Replace("{COUNT}", object_count.ToString()));
                };
                __instance.Add(Z.dropBoxSending);
            }
コード例 #2
0
            public static void Postfix(HoverTextConfiguration __instance,
                                       HoverTextDrawer drawer)
            {
                if (__instance == null)
                {
                    return;
                }
                if (!(__instance is BuildToolHoverTextCard))
                {
                    return;
                }
                BuildToolHoverTextCard hover_text_card
                    = (BuildToolHoverTextCard)__instance;

                if (hover_text_card.currentDef == null)
                {
                    return;
                }
                if (hover_text_card.currentDef.BuildingComplete == null)
                {
                    return;
                }

                ZTransporter possible_ztransport = hover_text_card.currentDef.BuildingComplete.GetComponent <ZTransporter>();

                if (possible_ztransport != null)
                {
                    drawer.NewLine(26);  // All the cool kids are doing it -SB
                    drawer.AddIndent(8); // I LEARNED IT FROM WATCHING [Klei] -SB
                    int x, y;

                    var pos   = KInputManager.GetMousePos();
                    var point = Camera.main.ScreenToWorldPoint(pos);
                    var cell  = Grid.PosToCell(point);
                    Grid.CellToXY(cell, out x, out y);

                    var coords_string = STRINGS.ZTRANSPORT.STATUSITEMS.ZCOORDINATES.NAME.Replace("{X}", x.ToString()).Replace("{Y}", y.ToString());
                    drawer.DrawText(coords_string,
                                    hover_text_card.Styles_Instruction.Standard);
                }
            }