Ejemplo n.º 1
0
        public MiniMap( MiniMapDef miniMapDef )
        {
            this.miniMapDef = miniMapDef;
            this._hidden = this.miniMapDef.hiddenByDefault;

            overlayWorkers = new List<MiniMapOverlay>();

            for( int index = 0; index < this.miniMapDef.overlays.Count; ++index )
            {
                var overlayData = this.miniMapDef.overlays[ index ];
                if(
                    ( overlayData.overlayClass == null )||
                    (
                        ( overlayData.overlayClass != typeof(MiniMapOverlay ) )&&
                        ( !overlayData.overlayClass.IsSubclassOf( typeof(MiniMapOverlay ) ) )
                    )
                )
                {
                    CCL_Log.Trace(
                        Verbosity.NonFatalErrors,
                        string.Format( "Unable to resolve overlayClass for '{0}' at index {1} to 'CommunityCoreLibrary.MiniMapOverlay'", miniMapDef.defName, index )
                    );
                    return;
                }
                else
                {
                    var overlayWorker = (MiniMapOverlay)Activator.CreateInstance( overlayData.overlayClass, new System.Object[] { this, overlayData } );
                    if( overlayWorker == null )
                    {
                        CCL_Log.Trace(
                            Verbosity.NonFatalErrors,
                            string.Format( "Unable to create instance of '{0}' for '{1}'", overlayData.overlayClass.Name, miniMapDef.defName )
                        );
                        return;
                    }
                    else
                    {
                        overlayWorkers.Add( overlayWorker );
                        CCL_Log.Trace(
                            Verbosity.Injections,
                            string.Format( "Added overlay '{0}' to '{1}' at draw position {2}", overlayData.overlayClass.Name, this.miniMapDef.defName, ( this.miniMapDef.drawOrder + overlayData.drawOffset ) )
                        );
                    }
                }
            }

            dirty = true;
        }
Ejemplo n.º 2
0
 public MiniMap_Areas( MiniMapDef def )
     : base(def)
 {
 }