当前位置: 首页>>代码示例>>C#>>正文


C# Planet.getResourceCount方法代码示例

本文整理汇总了C#中Planet.getResourceCount方法的典型用法代码示例。如果您正苦于以下问题:C# Planet.getResourceCount方法的具体用法?C# Planet.getResourceCount怎么用?C# Planet.getResourceCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Planet的用法示例。


在下文中一共展示了Planet.getResourceCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BarracksAvailable

 /// <summary>Indica se o planeta tem mercado</summary>
 public static bool BarracksAvailable( Planet planet )
 {
     return planet.getResourceCount("Building", "Barracks") > 0;
 }
开发者ID:zi-yu,项目名称:orionsbelt,代码行数:5,代码来源:SubSectionMenu.cs

示例2: MarketAvailable

 /// <summary>Indica se o planeta tem mercado</summary>
 public static bool MarketAvailable( Planet planet )
 {
     return planet.getResourceCount("Building", "Marketplace") > 0;
 }
开发者ID:zi-yu,项目名称:orionsbelt,代码行数:5,代码来源:SubSectionMenu.cs

示例3: GetTeletransportationCost

        private string GetTeletransportationCost( Planet planet )
        {
            StringWriter writer = new StringWriter();

            foreach( ResourceFactory factory in Universe.getFactories("planet", "Intrinsic").Values ) {
                if( Resource.IsTeletransportable(factory.create()) ) {
                    writer.WriteLine("teleCost['{0}'] = {1};", factory.Name, Resource.TeletransportationCost("Intrinsic", factory.Name, 1));
                }
            }

            foreach( ResourceFactory factory in Universe.getFactories("planet", "Rare").Values ) {
                    if( planet.getResourceCount(factory.Category, factory.Name) > 0 ) {
                        writer.WriteLine("teleCost['{0}'] = {1};", factory.Name, Resource.TeletransportationCost("Rare", factory.Name, 1));
                    }
            }

            return writer.ToString();
        }
开发者ID:zi-yu,项目名称:orionsbelt,代码行数:18,代码来源:Teletransportation.cs

示例4: GetQuantities

        private string GetQuantities( Planet planet )
        {
            StringWriter writer = new StringWriter();

            foreach( ResourceFactory factory in Universe.getFactories("planet", "Intrinsic").Values ) {
                if( Resource.IsTeletransportable(factory.create()) ) {
                    writer.WriteLine("iQuantities['{0}'] = {1};", factory.Name, planet.getResourceCount(factory.Category, factory.Name));
                }
            }

            foreach( ResourceFactory factory in Universe.getFactories("planet", "Rare").Values ) {
                int quantity = planet.getResourceCount(factory.Category, factory.Name);
                if( Resource.IsTeletransportable(factory.create()) && quantity > 0 ) {
                    writer.WriteLine("iQuantities['{0}'] = {1};", factory.Name, quantity);
                }
            }

            return writer.ToString();
        }
开发者ID:zi-yu,项目名称:orionsbelt,代码行数:19,代码来源:Teletransportation.cs

示例5: GetIntrinsic

        /// <summary>Indica os recursos intrinsecos a mostrar</summary>
        private void GetIntrinsic( Planet planet, DropDownList drop )
        {
            drop.Items.Add( new ListItem(string.Empty, string.Empty) );

            foreach( ResourceFactory factory in Universe.getFactories("planet", "Intrinsic").Values ) {
                int quantity = planet.getResourceCount("Intrinsic", factory.Name);
                if( quantity > 0 && Resource.IsTeletransportable(factory.create()) ) {
                    drop.Items.Add( new ListItem(info.getContent(factory.Name), factory.Name) );
                }
            }

            foreach( ResourceFactory factory in Universe.getFactories("planet", "Rare").Values ) {
                int quantity = planet.getResourceCount("Rare", factory.Name);
                if( quantity > 0 && Resource.IsTeletransportable(factory.create()) ) {
                    drop.Items.Add( new ListItem(info.getContent(factory.Name), factory.Name) );
                }
            }
        }
开发者ID:zi-yu,项目名称:orionsbelt,代码行数:19,代码来源:Teletransportation.cs

示例6: WriteMarketItems

        private void WriteMarketItems( StringWriter writer, MarketItem[] items, string var, Planet planet )
        {
            writer.WriteLine("var {0} = new Object();", var);
            writer.WriteLine("var {0}Array = new Array();", var);
            writer.WriteLine("var {0}Totals = new Object();", var);
            writer.WriteLine("var {0}ArrayCount = {1};", var, items.Length);
            int i = 0;
            foreach( MarketItem item in items ) {

                int totalQuantity = planet.getResourceCount(item.Resource.Factory.Category, item.Resource.Name);
                int totalMoney = planet.Gold;
                int total = 1;
                if( var == "sell" ) {
                    total = totalQuantity;
                } else {
                    total = totalMoney / item.Price;
                }

                writer.WriteLine("{0}[\"{1}\"] = {2};", var, item.Resource.Name, item.Price);
                writer.WriteLine("{0}Array[{1}] = \"{2}\";", var, i++, item.Resource.Name);
                writer.WriteLine("{0}Totals[\"{1}\"] = {2};", var, item.Resource.Name, total);
            }
        }
开发者ID:zi-yu,项目名称:orionsbelt,代码行数:23,代码来源:Market.cs


注:本文中的Planet.getResourceCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。