示例#1
0
        private void UpdateLineItemText(Widget LineItem, ResourceAmount Resource)
        {
            var resourceInfo = ResourceLibrary.GetResourceByName(Resource.ResourceType);

            LineItem.GetChild(1).Text = resourceInfo.ShortName ?? resourceInfo.ResourceName;
            LineItem.GetChild(1).Invalidate();
            LineItem.GetChild(2).Text = String.Format("{0}",
                                                      ValueSourceEntity.ComputeValue(Resource.ResourceType));
            var counter = LineItem.GetChild(0).Children.Last();

            counter.Text = Resource.NumResources.ToString();
            counter.Invalidate();
            LineItem.GetChild(0).Invalidate();
            LineItem.Tooltip = resourceInfo.ResourceName + "\n" + resourceInfo.Description;
            for (int i = 0; i < 3; i++)
            {
                if (i > 0)
                {
                    LineItem.GetChild(i).TextColor = Resource.NumResources > 0
                        ? Color.Black.ToVector4()
                        : new Vector4(0.5f, 0.5f, 0.5f, 0.5f);
                }
                LineItem.GetChild(i).BackgroundColor = Resource.NumResources > 0
                    ? resourceInfo.Tint.ToVector4()
                    : new Vector4(0.5f, 0.5f, 0.5f, 0.5f);
                LineItem.GetChild(i).Tooltip = resourceInfo.ResourceName + "\n" + resourceInfo.Description;
                LineItem.GetChild(i).Invalidate();
            }
        }
示例#2
0
        // Aggregates resources by tags so that there aren't as many to display.
        private List <AggregatedResource> AggregateResources(IEnumerable <KeyValuePair <string, Pair <ResourceAmount> > > resources)
        {
            List <AggregatedResource> aggregated = new List <AggregatedResource>();

            foreach (var pair in resources)
            {
                var resource = ResourceLibrary.GetResourceByName(pair.Value.First.ResourceType);
                var existing = aggregated.FirstOrDefault(existingResource =>
                                                         AreListsEqual(ResourceLibrary.GetResourceByName(existingResource.Amount.First.ResourceType).Tags, resource.Tags));

                if (existing != null)
                {
                    existing.Amount.First.NumResources  += pair.Value.First.NumResources;
                    existing.Amount.Second.NumResources += pair.Value.Second.NumResources;
                    existing.Members.Add(String.Format("{0}x {1}", pair.Value.First.NumResources, pair.Value.First.ResourceType));
                }
                else
                {
                    aggregated.Add(new AggregatedResource()
                    {
                        Amount  = pair.Value,
                        Members = new List <string>()
                        {
                            String.Format("{0}x {1}", pair.Value.First.NumResources, pair.Value.First.ResourceType)
                        }
                    });
                }
            }
            return(aggregated);
        }
示例#3
0
        /// <summary>Called when behaviour instance is being loaded</summary>
        public void Awake()
        {
            // Set the singleton instance
            if (GameBehaviour.Instance != null)
            {
                throw new InvalidOperationException("Only one instance of GameBehaviour is allowed per scene");
            }

            GameBehaviour.Instance = this;

            // Resolve the asset loaders
            ResourceManager.RegisterResourceLoaders(GlobalContainer.ResolveAll <IResourceLoader>());

            // Register the resource library singleton
            var resources = ResourceLibrary.FromString(this.ResourceLibraryXml.text);

            new DependencyContainer().RegisterSingleton <IResourceLibrary>(resources);

            // Create the IGame instance
            var gameDefinition = resources.GetSerializedResource <GameDefinition>(this.GameDefinitionId);

            this.game = (UnityGame)GlobalContainer.Resolve <IGameFactory>().Create(gameDefinition);

            //// Log.Trace("Loaded game '{0}' with {1} levels:\n{2}", this.game.Title, this.game.Levels.Length, string.Join("\n", this.game.Levels.Select(l => "{0} ({1})".FormatInvariant(l.Title, l.Id)).ToArray()));

            //// TODO: Drive level loading from a menu system
            // Load the first level
            var firstLevel = this.game.Levels.First().Id;

            Log.Trace("Loading level '{0}'...", firstLevel);
            this.game.LoadLevel(firstLevel);
        }
示例#4
0
        private Widget CreateLineItem(ResourceAmount Resource)
        {
            var r = Root.ConstructWidget(new Gum.Widget
            {
                MinimumSize = new Point(1, 32),
                MaximumSize = new Point(1, 32)
            });

            var resourceInfo = ResourceLibrary.GetResourceByName(Resource.ResourceType);

            r.AddChild(new Gum.Widget
            {
                MinimumSize     = new Point(32, 32),
                MaximumSize     = new Point(32, 32),
                Background      = new TileReference("resources", resourceInfo.NewGuiSprite),
                AutoLayout      = AutoLayout.DockLeft,
                BackgroundColor = resourceInfo.Tint.ToVector4()
            });

            r.AddChild(new Gum.Widget
            {
                AutoLayout = AutoLayout.DockFill,
                //Text = String.Format("{0} at ${1}e", Resource.NumResources, resourceInfo.MoneyValue),
                //Font = "outline-font",
                //TextColor = new Vector4(1,1,1,1),
                TextVerticalAlign = VerticalAlign.Center
            });

            UpdateLineItemText(r, Resource);

            return(r);
        }
示例#5
0
        public override void Construct()
        {
            Font = "font16";

            OnUpdate = (sender, time) =>
            {
                var builder = new StringBuilder();
                builder.AppendFormat("Liquid assets: ${0}\n", Faction.Treasurys.Select(t => t.Money.Value).Sum());

                var resources = Faction.ListResourcesInStockpilesPlusMinions();

                builder.AppendFormat("Material assets: {0} resources valued at ${1}\n", resources.Values.Select(r => r.First.NumResources + r.Second.NumResources).Sum(),
                                     resources.Values.Select(r =>
                {
                    var value = ResourceLibrary.GetResourceByName(r.First.ResourceType).MoneyValue.Value;
                    return((r.First.NumResources * value) + (r.Second.NumResources * value));
                }).Sum());

                builder.AppendFormat("{0} employees at ${1} per day.\n", Faction.Minions.Count, Faction.Minions.Select(m => m.Stats.CurrentLevel.Pay.Value).Sum());

                var freeStockPile  = Faction.ComputeRemainingStockpileSpace();
                var totalStockPile = Faction.ComputeTotalStockpileSpace();
                builder.AppendFormat("Stockpile space: {0} used of {1} ({2:00.00}%)\n", totalStockPile - freeStockPile, totalStockPile, (float)(totalStockPile - freeStockPile) / (float)totalStockPile * 100.0f);

                Text = builder.ToString();
            };

            Root.RegisterForUpdate(this);
        }
        public void SerializedResourceLibraryRoundtrip()
        {
            var expected         = Guid.NewGuid().ToString();
            var expectedResource = new GenericNativeResource <string>(expected);
            var resourceUri      = ResourcesHelper.NewTestResourceUri(expectedResource.Id);

            ResourceManager.RegisterResourceLoader(ResourcesHelper.TestResourceLoader <string>(id => expectedResource));

            var library  = new ResourceLibrary();
            var resource = library.GetResourceByUri <GenericNativeResource <string> >(resourceUri);

            Assert.IsNotNull(resource);
            Assert.AreEqual(expected, resource.NativeResource);

            var libraryXml = Encoding.UTF8.GetString(library.ToBytes());

            Assert.IsFalse(string.IsNullOrEmpty(libraryXml));

            var savedLibrary = ResourceLibrary.FromBytes(Encoding.UTF8.GetBytes(libraryXml));

            Assert.IsNotNull(savedLibrary);

            var resourceById  = savedLibrary.GetResource <GenericNativeResource <string> >(expectedResource.Id);
            var resourceByUri = savedLibrary.GetResourceByUri <GenericNativeResource <string> >(resourceUri);

            Assert.AreSame(resourceById, resourceByUri);
            Assert.AreEqual(expected, resourceById.NativeResource);
        }
        public static DatabaseResourceLibrary Create(IQuiltContextFactory quiltContextFactory, JToken json)
        {
            if (json == null)
            {
                throw new ArgumentNullException(nameof(json));
            }

            var libraryName = json.Value <string>(Json_Name);

            using (var ctx = quiltContextFactory.Create())
            {
                var dbResourceLibrary = ctx.ResourceLibraries.Where(r => r.Name == libraryName).SingleOrDefault();
                if (dbResourceLibrary == null)
                {
                    dbResourceLibrary = new ResourceLibrary()
                    {
                        Name = libraryName
                    };
                    _ = ctx.ResourceLibraries.Add(dbResourceLibrary);
                }

                foreach (var jsonEntry in json[Json_Entries])
                {
                    var entry = new ResourceLibraryEntry(jsonEntry);

                    var dbResourceType = ctx.ResourceTypes.Where(r => r.Name == entry.Type).SingleOrDefault();
                    if (dbResourceType == null)
                    {
                        // Look for resource types created below.  These entries aren't normally found until
                        // ctx.SaveChanges is called.
                        //
                        dbResourceType = ctx.ResourceTypes.Local.Where(r => r.Name == entry.Type).SingleOrDefault();
                    }
                    if (dbResourceType == null)
                    {
                        dbResourceType = new ResourceType()
                        {
                            Name = entry.Type
                        };
                        _ = ctx.ResourceTypes.Add(dbResourceType);
                    }

                    var dbResource = dbResourceLibrary.Resources.Where(r => r.Name == entry.Name).SingleOrDefault();
                    if (dbResource == null)
                    {
                        dbResource = new Resource()
                        {
                            Name = entry.Name
                        };
                        _ = ctx.Resources.Add(dbResource);
                    }
                    dbResource.ResourceType = dbResourceType;
                    dbResource.ResourceData = entry.Data;
                }

                _ = ctx.SaveChanges();
            }

            return(Load(quiltContextFactory, libraryName));
        }
示例#8
0
 public MainMenuState(DwarfGame game, GameStateManager stateManager)
     : base(game, "MainMenuState", stateManager)
 {
     ResourceLibrary library = new ResourceLibrary();
     IsGameRunning = false;
     MaintainState = false;
 }
示例#9
0
    void ShowPossibleDroplocations()
    {
        SimpleCords origin = originLocation;
        GameObject  GOo    = GameObject.Instantiate(ResourceLibrary.GetPrefabByName("prop_TileHighlightOrigin"));

        GOo.transform.position = origin;
        possiblePositionsGO    = new List <GameObject>();
        possiblePositions      = new List <SimpleCords>();
        possiblePositionsGO.Add(GOo);
        possiblePositions.Add(origin);

        //TODO: change it to whatever we want
        Offset[] miniOffsets = new Offset[]
        {
            new Offset(1, 0),
            new Offset(-1, 0),
            new Offset(0, 1),
            new Offset(0, -1),
        };

        foreach (var item in miniOffsets)
        {
            SimpleCords pos = origin;
            pos = pos.OffsetBy(item);
            Tile currCheck;
            while ((currCheck = space.Map.SaveGet(pos.x, pos.z)).occupation == TileOccupation.Empty)
            {
                GameObject tmp = GameObject.Instantiate(ResourceLibrary.GetPrefabByName("prop_TileHighlightGood"));
                tmp.transform.position = pos;
                possiblePositions.Add(pos);
                possiblePositionsGO.Add(tmp);
                pos = pos.OffsetBy(item);
            }
        }
    }
示例#10
0
        private void InitResourceLibrary()
        {
            ResourceLibrary resourceLibrary = CreateResourceLibrary();

            resourceLibrary.PrepareLocalizationResourceFiles();
            Localization.LoadLocalizationContent();
        }
示例#11
0
        //Defialt Constructor
        //Sets image to new
        public Ghost(ResourceLibrary library) : base(library)
        {
            explodeSprite    = (Sprite)library.getResource("GhostLight/GhostLight/resources/explode/explode1.png");
            angrySprite      = (Sprite)library.getResource("GhostLight/GhostLight/resources/angry-ghost1.png");
            complacentSprite = (Sprite)library.getResource("GhostLight/GhostLight/resources/ghost1.png");

            type = InteractableObject.ObjectType.GHOST;
            MakeNotAngry();
            unrevealType();
            health.setMaxSegments(InteractableObject.getDefualthealth(type));
            health.setFilledSegments(health.getMaxSegments());
            score = InteractableObject.getDefualtScore(type);
            base.setInvulnerablility(InteractableObject.getDefualtInvulnerability(type));

            health.setHeight(0.35f);

            explodeTimer.setHeight(0.7f);
            explodeTimer.visible = false;
            explodeTimer.setCenterX(base.getCenterX());
            explodeTimer.setCenterY(health.getCenterY() - (base.getHeight() / 2) + 0.35f);
            explodeTimer.setWidth(base.getWidth());
            explodeTimer.setColor(Color.Yellow);
            explodeTimer.setMaxSegments(angrySprite.getTotalFrames() + complacentSprite.getTotalFrames());
            explodeTimer.setFilledSegments(explodeTimer.getMaxSegments());
        }
示例#12
0
 public static void Close()
 {
     Instance._localization     = null;
     Instance._resourceProvider = null;
     ResourceLibrary.Close();
     CloseInstance();
 }
示例#13
0
 // Construct the CarpenterActions list.
 public CarpenterActions()
 {
     ResourceLibrary = new ResourceLibrary(Settings.ResourceLocation, ClassJobType.Carpenter);
     BasicSynthesis = new BasicSynthesis(CraftActionId.crp_BasicSynthesis,
         ResourceLibrary.ClassSkillImages["crp_BasicSynthesis"]);
     StandardSynthesis = new StandardSynthesis(CraftActionId.crp_StandardSynthesis,
         ResourceLibrary.ClassSkillImages["crp_StandardSynthesis"]);
     BasicTouch = new BasicTouch(CraftActionId.crp_BasicTouch, ResourceLibrary.ClassSkillImages["crp_BasicTouch"]);
     StandardTouch = new StandardTouch(CraftActionId.crp_StandardTouch,
         ResourceLibrary.ClassSkillImages["crp_StandardTouch"]);
     AdvancedTouch = new AdvancedTouch(CraftActionId.crp_AdvancedTouch,
         ResourceLibrary.ClassSkillImages["crp_AdvancedTouch"]);
     PreciseTouch = new PreciseTouch(CraftActionId.crp_PreciseTouch,
         ResourceLibrary.ClassSkillImages["crp_PreciseTouch"]);
     MastersMend = new MastersMend(CraftActionId.crp_MastersMend);
     MastersMendII = new MastersMendII(CraftActionId.crp_MastersMendII);
     SteadyHand = new SteadyHand(CraftActionId.crp_SteadyHand);
     InnerQuiet = new InnerQuiet(CraftActionId.crp_InnerQuiet);
     GreatStrides = new GreatStrides(CraftActionId.crp_GreatStrides);
     Observe = new Observe(CraftActionId.crp_Observe);
     CollectableSynthesis = new CollectableSynthesis(CraftActionId.crp_CollectableSynthesis);
     ByregotsBrow = new ByregotsBrow(CraftActionId.crp_ByregotsBrow);
     InnovativeTouch = new InnovativeTouch(CraftActionId.crp_InnovativeTouch);
     ByregotsMiracle = new ByregotsMiracle(CraftActionId.crp_ByregotsMiracle);
     NymeiasWheel = new NymeiasWheel(CraftActionId.crp_NymeiasWheel);
     TrainedHand = new TrainedHand(CraftActionId.crp_TrainedHand);
     Satisfaction = new Satisfaction(CraftActionId.crp_Satisfaction);
     Heart = new Heart(CraftActionId.crp_Heart);
     WhistleWhileYouWork = new WhistleWhileYouWork(CraftActionId.crp_WhistleWhileYouWork);
     PHTouch = new PHTouch(CraftActionId.crp_PreciseTouch);
 }
示例#14
0
        private void MoveRandomValue(IEnumerable <ResourceAmount> source, List <ResourceAmount> destination,
                                     ITradeEntity trader)
        {
            foreach (var amount in source)
            {
                Resource r = ResourceLibrary.GetResourceByName(amount.ResourceType);
                if (trader.TraderRace.HatedResources.Any(tag => r.Tags.Contains(tag)))
                {
                    continue;
                }
                if (amount.NumResources == 0)
                {
                    continue;
                }
                ResourceAmount destAmount =
                    destination.FirstOrDefault(resource => resource.ResourceType == amount.ResourceType);
                if (destAmount == null)
                {
                    destAmount = new ResourceAmount(amount.ResourceType, 0);
                    destination.Add(destAmount);
                }

                int numToMove = MathFunctions.RandInt(1, amount.NumResources + 1);
                amount.NumResources     -= numToMove;
                destAmount.NumResources += numToMove;
                break;
            }
        }
示例#15
0
        private void RemoveCategory_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            ResourceLibrary currentResource = (ResourceLibrary)View.CurrentObject;

            View.ObjectSpace.SetModified(currentResource);

            ArrayList arrayList = new ArrayList();

            foreach (TemporaryResourceCategory temp in e.PopupWindow.View.SelectedObjects)
            {
                foreach (ResourceCategory cat in currentResource.ResourceCategories)
                {
                    if (cat.Oid == temp.Category.Oid)
                    {
                        arrayList.Add(cat);
                    }
                }
            }
            foreach (ResourceCategory toDelete in arrayList)
            {
                currentResource.ResourceCategories.Remove(toDelete);
            }

            if (View is DetailView && ((DetailView)View).ViewEditMode == ViewEditMode.View)
            {
                View.ObjectSpace.CommitChanges();
                Frame.View.ObjectSpace.Refresh();
            }
        }
示例#16
0
        public MainMenuState(DwarfGame game, GameStateManager stateManager) :
            base(game, "MainMenuState", stateManager)
        {
            ResourceLibrary library = new ResourceLibrary();

            IsGameRunning = false;
            MaintainState = false;
        }
示例#17
0
 public static void preLoadResources(ResourceLibrary library)
 {
     if (library.getResource("GhostLight/GhostLight/resources/mummy.png") == null)
     {
         Sprite mum = new Sprite("GhostLight/GhostLight/resources/mummy.png");
         mum.loadResource();
         library.addResource(mum);
     }
 }
示例#18
0
 public static void preLoadResources(ResourceLibrary library)
 {
     if (library.getResource("GhostLight/GhostLight/resources/dracula.png") == null)
     {
         Sprite vampire = new Sprite("GhostLight/GhostLight/resources/dracula.png");
         vampire.loadResource();
         library.addResource(vampire);
     }
 }
示例#19
0
 public static void preLoadResources(ResourceLibrary library)
 {
     if (library.getResource("GhostLight/GhostLight/resources/spider.png") == null)
     {
         Sprite spiderMan = new Sprite("GhostLight/GhostLight/resources/spider.png");
         spiderMan.loadResource();
         library.addResource(spiderMan);
     }
 }
示例#20
0
 public static void preLoadResources(ResourceLibrary library)
 {
     if (library.getResource("GhostLight/GhostLight/resources/frankenstein.png") == null)
     {
         Sprite frank = new Sprite("GhostLight/GhostLight/resources/frankenstein.png");
         frank.loadResource();
         library.addResource(frank);
     }
 }
示例#21
0
 public static void preLoadResources(ResourceLibrary library)
 {
     if (library.getResource("GhostLight/GhostLight/resources/zombie.png") == null)
     {
         Sprite zombie = new Sprite("GhostLight/GhostLight/resources/zombie.png");
         zombie.loadResource();
         library.addResource(zombie);
     }
 }
示例#22
0
 public static void preLoadResources(ResourceLibrary library)
 {
     if (library.getResource("GhostLight/GhostLight/resources/pumpkin.png") == null)
     {
         Sprite pumpkin = new Sprite("GhostLight/GhostLight/resources/pumpkin.png");
         pumpkin.loadResource();
         library.addResource(pumpkin);
     }
 }
示例#23
0
        public MainMenuState(DwarfGame game, GameStateManager stateManager) :
            base(game, "MainMenuState", stateManager)
        {
            ResourceLibrary library = new ResourceLibrary();

            Embarkment.Initialize();
            VoxelChunk.InitializeStatics();
            IsGameRunning = false;
            MaintainState = false;
        }
示例#24
0
 public Cat(ResourceLibrary library) : base(library)
 {
     type = InteractableObject.ObjectType.CAT;
     health.setMaxSegments(InteractableObject.getDefualthealth(type));
     health.setFilledSegments(health.getMaxSegments());
     score = InteractableObject.getDefualtScore(type);
     base.setInvulnerablility(InteractableObject.getDefualtInvulnerability(type));
     unrevealType();
     isHelpfull = true;
 }
示例#25
0
 public Zombie(ResourceLibrary library) : base(library)
 {
     zombie = (Sprite)library.getResource("GhostLight/GhostLight/resources/zombie.png");
     type   = InteractableObject.ObjectType.ZOMBIE;
     unrevealType();
     health.setMaxSegments(InteractableObject.getDefualthealth(type));
     health.setFilledSegments(health.getMaxSegments());
     score = InteractableObject.getDefualtScore(type);
     base.setInvulnerablility(InteractableObject.getDefualtInvulnerability(type));
 }
示例#26
0
    public static void CreateMyAsset()
    {
        ResourceLibrary asset = ScriptableObject.CreateInstance <ResourceLibrary>();

        AssetDatabase.CreateAsset(asset, "Assets/Resources/ResourceLibrary_new.asset");
        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();
        Selection.activeObject = asset;
    }
示例#27
0
        private Widget CreateLineItem(ResourceAmount Resource)
        {
            var r = Root.ConstructWidget(new Gui.Widget
            {
                MinimumSize = new Point(1, 32),
                Background  = new TileReference("basic", 0)
            });

            var resourceInfo = ResourceLibrary.GetResourceByName(Resource.ResourceType);

            var icon = r.AddChild(new ResourceIcon()
            {
                MinimumSize         = new Point(32 + 16, 32 + 16),
                MaximumSize         = new Point(32 + 16, 32 + 16),
                Layers              = resourceInfo.GuiLayers,
                AutoLayout          = AutoLayout.DockLeft,
                BackgroundColor     = Resource.NumResources > 0 ? resourceInfo.Tint.ToVector4() : new Vector4(0.5f, 0.5f, 0.5f, 0.5f),
                TextColor           = Color.White.ToVector4(),
                TextHorizontalAlign = HorizontalAlign.Right,
                TextVerticalAlign   = VerticalAlign.Bottom
            });

            r.AddChild(new Gui.Widget
            {
                AutoLayout          = AutoLayout.DockLeft,
                MinimumSize         = new Point(128 / GameSettings.Default.GuiScale, 0),
                MaximumSize         = new Point(128 / GameSettings.Default.GuiScale, 32),
                TextColor           = Resource.NumResources > 0 ? Color.Black.ToVector4() : new Vector4(0.5f, 0.5f, 0.5f, 0.5f),
                TextVerticalAlign   = VerticalAlign.Center,
                TextHorizontalAlign = HorizontalAlign.Left,
                HoverTextColor      = GameSettings.Default.Colors.GetColor("Highlight", Color.DarkRed).ToVector4(),
                Font = GameSettings.Default.GuiScale == 1 ? "font10" : "font8",
                ChangeColorOnHover = true,
                WrapText           = true
            });

            r.AddChild(new Gui.Widget
            {
                AutoLayout = AutoLayout.DockRight,
                //Text = String.Format("{0} at ${1}e", Resource.NumResources, resourceInfo.MoneyValue),
                //Font = "font18-outline",
                //TextColor = new Vector4(1,1,1,1),
                TextColor         = Resource.NumResources > 0 ? Color.Black.ToVector4() : new Vector4(0.5f, 0.5f, 0.5f, 0.5f),
                TextVerticalAlign = VerticalAlign.Center,
                HoverTextColor    = GameSettings.Default.Colors.GetColor("Highlight", Color.DarkRed).ToVector4(),
                Font = GameSettings.Default.GuiScale == 1 ? "font10" : "font8",
                ChangeColorOnHover = true,
            });


            r.Layout();
            UpdateLineItemText(r, Resource);

            return(r);
        }
示例#28
0
        protected DrawRectangle web = null;                  //The Web the spider will hang from while Droping

        public Spider(ResourceLibrary library) : base(library)
        {
            spider = (Sprite)library.getResource("GhostLight/GhostLight/resources/spider.png");

            type = InteractableObject.ObjectType.SPIDER;
            unrevealType();
            health.setMaxSegments(InteractableObject.getDefualthealth(type));
            health.setFilledSegments(health.getMaxSegments());
            score = InteractableObject.getDefualtScore(type);
            base.setInvulnerablility(InteractableObject.getDefualtInvulnerability(type));
        }
示例#29
0
 public Pumpkin(ResourceLibrary library) : base(library)
 {
     pumpkin         = (Sprite)library.getResource("GhostLight/GhostLight/resources/pumpkin.png");
     type            = InteractableObject.ObjectType.PUMPKIN;
     base.isHelpfull = true;
     unrevealType();
     health.setMaxSegments(InteractableObject.getDefualthealth(type));
     health.setFilledSegments(health.getMaxSegments());
     score = InteractableObject.getDefualtScore(type);
     base.setInvulnerablility(InteractableObject.getDefualtInvulnerability(type));
 }
示例#30
0
 public Frankenstein(ResourceLibrary library) : base(library)
 {
     frankenstien   = (Sprite)library.getResource("GhostLight/GhostLight/resources/frankenstein.png");
     type           = InteractableObject.ObjectType.FRANKENSTEIN;
     isTypeRevealed = false;
     unrevealType();
     health.setMaxSegments(InteractableObject.getDefualthealth(type));
     health.setFilledSegments(health.getMaxSegments());
     score = InteractableObject.getDefualtScore(type);
     base.setInvulnerablility(InteractableObject.getDefualtInvulnerability(type));
 }
示例#31
0
        private void AddCategory_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            ResourceLibrary      currentResource        = (ResourceLibrary)View.CurrentObject;
            IObjectSpace         objectSpace            = Application.CreateObjectSpace(typeof(ResourceCategory));
            string               resourceCategoryListId = Application.FindLookupListViewId(typeof(ResourceCategory));
            CollectionSourceBase collectionSource       = Application.CreateCollectionSource(objectSpace, typeof(ResourceCategory), resourceCategoryListId);
            ListView             view = Application.CreateListView(resourceCategoryListId, collectionSource, true);

            //view.CollectionSource.Criteria["Filter1"] = CriteriaOperator.Parse("[Organization] = ?", objectSpace.GetObject<Organization>(currentSchedule.Organization));
            e.Context = TemplateContext.FindPopupWindow;
            e.View    = view;
        }
示例#32
0
 public void Place(SimpleCords atLocation)
 {
     if (usable)
     {
         GameObject obj = Object.Instantiate(ResourceLibrary.GetPrefabByName(VisualName));
         obj.transform.position = new Vector3(atLocation.x, atLocation.y + 0.5f, atLocation.z);
         GameObject             = obj;
     }
     else
     {
         throw new System.Exception("Used Unusable Material!");
     }
 }
示例#33
0
        public void AddToResourceLibrary(ResourceLibrary resourceLibrary, TileManagerViewState viewState)
        {
            var movePath = String.Empty;
            ObservableCollection<Tile> collection = null; ;

            switch (viewState)
            {
                case TileManagerViewState.AddNewFloorTiles:
                    movePath = Constants.RESOURCE_LIBRARY_MANAGED_FLOOR_TILES;
                    collection = resourceLibrary.FloorTiles;
                    break;
                case TileManagerViewState.AddNewWallTiles:
                    movePath = Constants.RESOURCE_LIBRARY_MANAGED_WALL_TILES;
                    collection = resourceLibrary.WallTiles;
                    break;
                case TileManagerViewState.AddNewDecorTiles:
                    movePath = Constants.RESOURCE_LIBRARY_MANAGED_DECOR_TILES;
                    collection = resourceLibrary.DecorTiles;
                    break;
                default:
                    break;
            }

            //Step 1 - move source to managed raw assets
            var newFileLocation = Path.Combine(movePath, Path.GetFileName(_fileLocation));
            for (var fileNumber = 2; File.Exists(newFileLocation); fileNumber++)
            {
                var newFileName = Path.GetFileNameWithoutExtension(_fileLocation) + fileNumber.ToString() + Path.GetExtension(_fileLocation);
                newFileLocation = Path.Combine(movePath, newFileName);
            }
            File.Move(_fileLocation, newFileLocation);

            //Step 2 - add the resources
            foreach (Tile tile in Tiles)
            {
                collection.Add(tile);
            }

            //Step 3 - save the resourceLibrary
            resourceLibrary.Save();
        }
示例#34
0
 public IntroState(DwarfGame game, GameStateManager stateManager)
     : base(game, "IntroState", stateManager)
 {
     ResourceLibrary library = new ResourceLibrary();
 }
示例#35
0
 public TileManagerViewModel(ResourceLibrary resourceLibrary)
 {
     ResourceLibrary = resourceLibrary;
 }
示例#36
0
 public ManageMapViewModel(ResourceLibrary resourceLibrary)
 {
     ResourceLibrary = resourceLibrary;
 }