Exemple #1
0
 void Start()
 {
     // You can access a static method by using the class name
     // and the dot operator.
     int x = Utilities.Add(5, 6);
     // Yes, you can access without making "new".
 }
        public void GetDataForUtility(string utilityName)
        {
            using (var context = new TownUtilityBillSystemV2Entities())
            {
                var utilityDB   = context.UTILITYs.Where(u => u.NAME == utilityName).FirstOrDefault();
                var unitDB      = context.UNITs.Find(utilityDB.UNIT_ID);
                var utilitiesDB = context.UTILITYs.ToList();


                Unit.Id   = unitDB.ID;
                Unit.Name = unitDB.NAME;

                Utility.Id           = utilityDB.ID;
                Utility.Name         = utilityDB.NAME;
                Utility.Price        = utilityDB.PRICE;
                Utility.ResourceName = GetResourceNameForUtility(utilityDB.NAME);
                Utility.ImagePath    = HelperMethod.GetUtilityImage(utilityDB.ID);

                if (utilityDB.USAGEFORSTANDARTPRICE != null)
                {
                    Utility.UsageForStandartPrice = (decimal)utilityDB.USAGEFORSTANDARTPRICE;
                }
                if (utilityDB.BIGUSAGEPRICE != null)
                {
                    Utility.BigUsagePrice = (decimal)utilityDB.BIGUSAGEPRICE;
                }

                Utility.Unit = Unit;

                foreach (var u in utilitiesDB)
                {
                    if (u.NAME != Utility.Name)
                    {
                        Utilities.Add(new Utility()
                        {
                            Name = u.NAME, ResourceName = GetResourceNameForUtility(u.NAME)
                        });
                    }
                }

                var           meterTypesDB  = context.METER_TYPEs.Where(mt => mt.UTILITY_ID == Utility.Id).ToList();
                var           metersDB      = context.METERs.ToList();
                HashSet <int> meterTypesIds = new HashSet <int>();

                foreach (var m in meterTypesDB)
                {
                    meterTypesIds.Add(m.ID);
                }

                foreach (var m in metersDB)
                {
                    if (meterTypesIds.Contains(m.METER_TYPE_ID))
                    {
                        MeterQty += 1;
                    }
                }
            }
        }
    private static void Statics()
    {
        EnemyController enemy1 = new EnemyController();
        EnemyController enemy2 = new EnemyController();
        EnemyController enemy3 = new EnemyController();

        //You can access a static variable by using the class name and the dot operator.
        int counter = EnemyController.enemyCount;

        //You can access a static method by using the class name
        //and the dot operator.
        int x = Utilities.Add(5, 6);
    }
        public void GetUtilitiesName()
        {
            using (var context = new TownUtilityBillSystemV2Entities())
            {
                var utilitiesDB = context.UTILITYs.ToList();

                foreach (var item in utilitiesDB)
                {
                    Utilities.Add(new Utility {
                        Id = item.ID, Name = item.NAME, ResourceName = GetResourceNameForUtility(item.NAME)
                    });
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Apply a utility to the tank.
        /// </summary>
        /// <param name="utility">The utility</param>
        public void ApplyUtility(VTankObject.Utility utility)
        {
            Utilities.Add(utility);
            ActiveUtility autil = new ActiveUtility(utility);

            ParticleEmitterSettings pset = Renderer.RendererAssetPool.ParticleEmitterSettings["Utility"];

            pset.LifeSpan           = utility.duration;
            pset.ParticleSystemName = utility.model;
            autil.Emitter           = new ParticleEmitter(pset);
            autil.Emitter.Position  = Position;
            autil.Emitter.MimicPosition(this, Vector3.Zero);
            ServiceManager.Scene.Add(autil.Emitter, 3);

            activeUtilities.Add(autil);
        }
Exemple #6
0
    public bool PlaceUtility(Utility objInstance)
    {
        if (objInstance == null)
        {
            return(false);
        }

        if (objInstance.IsValidPosition(this) == false)
        {
            UnityDebugger.Debugger.LogError("Tile", "Trying to assign a furniture to a tile that isn't valid!");
            return(false);
        }

        Utilities.Add(objInstance.Type, objInstance);

        return(true);
    }
Exemple #7
0
    public bool PlaceUtility(Utility objInstance)
    {
        if (objInstance == null)
        {
            return(false);
        }

        if (objInstance.IsValidPosition(this) == false)
        {
            Debug.ULogErrorChannel("Tile", "Trying to assign a NestedObject to a tile that isn't valid!");
            return(false);
        }

        Utilities.Add(objInstance.Name, objInstance);

        return(true);
    }
        public void GetAllUtilitiesPrices()
        {
            using (var context = new TownUtilityBillSystemV2Entities())
            {
                var utilitiesDB = context.UTILITYs.ToList();

                foreach (var item in utilitiesDB)
                {
                    var unitDB = context.UNITs.Where(u => u.ID == item.UNIT_ID).FirstOrDefault();
                    var unit   = new Unit()
                    {
                        Id = unitDB.ID, Name = unitDB.NAME
                    };

                    if (item.USAGEFORSTANDARTPRICE != null && item.BIGUSAGEPRICE != null)
                    {
                        Utilities.Add(new Utility
                        {
                            Id                    = item.ID,
                            Name                  = item.NAME,
                            Price                 = item.PRICE,
                            BigUsagePrice         = (decimal)item.BIGUSAGEPRICE,
                            UsageForStandartPrice = Math.Round((decimal)item.USAGEFORSTANDARTPRICE, 0),
                            ImagePath             = HelperMethod.GetUtilityImage(item.ID),
                            Unit                  = unit,
                            ResourceName          = GetResourceNameForUtility(item.NAME)
                        });
                    }
                    else
                    {
                        Utilities.Add(new Utility
                        {
                            Id           = item.ID,
                            Name         = item.NAME,
                            Price        = item.PRICE,
                            ImagePath    = HelperMethod.GetUtilityImage(item.ID),
                            Unit         = unit,
                            ResourceName = GetResourceNameForUtility(item.NAME)
                        });
                    }
                }
            }
        }
 void Start()
 {
     //可以使用类名和点运算符
     //来访问静态方法。
     int x = Utilities.Add(5, 6);
 }
Exemple #10
0
 public static double Add(double x, double y)
 {
     return(Utilities.Add(x, y));
 }
    private void Start()
    {
        int x = Utilities.Add(5, 6);

        Debug.Log("Ex: " + x);
    }
 void Start()
 {
     //You can access a static method by using the class name
     //and the dot operator.
     int x = Utilities.Add(5, 6);
 }
Exemple #13
0
 public int OnUpdate(UpdateListener listener)
 {
     return(Utilities.Add(updateListeners, listener));
 }
Exemple #14
0
 public int OnAdd(AddListener listener)
 {
     return(Utilities.Add(addListeners, listener));
 }
 private static void MethodOverloading()
 {
     int    y = Utilities.Add(3, 4);
     string z = Utilities.Add("Hello", "World");
 }
Exemple #16
0
 static void Main(string[] args)
 {
     objUtilities = new Utilities();
     Console.WriteLine("Hello World!");
     int a = objUtilities.Add(2, 3);
 }
Exemple #17
0
 public int OnRemove(RemoveListener listener)
 {
     return(Utilities.Add(removeListeners, listener));
 }