예제 #1
0
            bool configBarStyle(string key, string value, Configuration.Options options)
            {
                rotation_ = (options.asFloat(0, Default.BarRotation) / 180f) * (float)Math.PI;

                switch (value.ToLower())
                {
                case "simple":
                    renderStyledBar_ = Graphic.renderSimpleBar;
                    break;

                case "segments":
                    renderStyledBar_ = Graphic.renderSegmentedBar;
                    break;

                case "tiles":
                    renderStyledBar_ = Graphic.renderTiledBar;
                    tiles_           = options.asInteger(1, Default.BarTileCount);
                    tileSpace_       = options.asFloat(2, Default.BarTileSpace);
                    if (options.Count >= 4)
                    {
                        if (!toValueType(options[3], out tileSpaceType_, Default.BarTileSpaceType))
                        {
                            return(false);
                        }
                    }

                    if (options.Count >= 5)
                    {
                        if (RenderTarget.spriteExist(options[4]))
                        {
                            tileName_ = options[4];
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    break;

                default:
                    log(Console.LogType.Error, $"Invalid bar style '{value}'");
                    return(false);
                }

                return(true);
            }
예제 #2
0
                bool configMaxAmountItem(string key, string value, Configuration.Options options)
                {
                    long amount = options.asInteger(0, (int)Default.MaxAmountItems);

                    if (amount <= 0)
                    {
                        return(false);
                    }

                    VISItemType item = $"{Default.MyObjectBuilder}_{value}";

                    if (item.Valid)
                    {
                        var list  = Default.AmountItems.ToList();
                        var index = list.FindIndex(pair => pair.Key == item);
                        if (index >= 0)
                        {
                            list.RemoveAt(index);
                        }

                        if (!item.Group)
                        {
                            list.Insert(0, new KeyValuePair <VISItemType, long>(item, amount));
                        }
                        else
                        {
                            list.Add(new KeyValuePair <VISItemType, long>(item, amount));
                        }

                        Default.AmountItems = list.ToDictionary((ik) => ik.Key, (iv) => iv.Value);
                        return(true);
                    }

                    manager_.log(Console.LogType.Error, $"Invalid item type \"{value}\"");
                    return(false);
                }
예제 #3
0
                bool configRTFixSize(string key, string value, Configuration.Options options)
                {
                    int            index = options.asInteger(0, 0);
                    RenderTargetID id    = $"{value}:{index}";

                    if (id == RenderTargetID.Invalid)
                    {
                        manager_.log(Console.LogType.Error, $"Invalid block id \"{value}\"");
                        return(false);
                    }

                    RectangleF rect = new RectangleF(options.asVector(2, new Vector2()), options.asVector(1, new Vector2()));

                    if (Default.RenderTargetFixSize.ToList().Exists((pair) => pair.Key.Equals(id)))
                    {
                        Default.RenderTargetFixSize[id] = rect;
                    }
                    else
                    {
                        Default.RenderTargetFixSize.Add(id, rect);
                    }

                    return(true);
                }
예제 #4
0
                /*bool configTemplate(string key, string value, Configuration.Options options)
                 * {
                 *  // create new template
                 *  manager_.log(Console.LogType.Error, "The template configuration isnt' fully implemented yet");
                 *  return false;
                 * }*/

                bool configConsole(string key, string value, Configuration.Options options)
                {
                    var block = App.GridTerminalSystem.GetBlockWithName(value);

                    if (block != null)
                    {
                        manager_.log(Console.LogType.Info, $"Console redirected to {block.CustomName}");
                        return(manager_.Console.redirectConsole(block as IMyTextSurfaceProvider, options.asInteger(0, 0)));
                    }

                    return(false);
                }
예제 #5
0
 bool configAutoScroll(string key, string value, Configuration.Options options)
 {
     autoScroll_    = Configuration.asBoolean(value, true);
     autoScrollInc_ = options.asInteger(0, 1);
     return(true);
 }
예제 #6
0
 bool configSetLine(string key, string value, Configuration.Options options)
 {
     spacing_ = Configuration.asFloat(value, 7f);
     lines_   = options.asInteger(0, 0);
     return(true);
 }