Beispiel #1
0
    public void AddShipToConstruct(string type, Costs cost)
    {
        ShipTime busySlot = new ShipTime();

        busySlot.cost = cost;
        if (type != "Miner")
        {
            busySlot.time = 5;
        }
        else
        {
            busySlot.time = 10;
        }
        busySlot.type = type;
        int i = 0;

        foreach (var item in CostructShips)
        {
            ShipTime temp = item.Value;
            if (temp.type == null)
            {
                CostructShips[item.Key] = busySlot;
                break;
            }
            i++;
        }
        if (i < slots.Count)
        {
            if (Werehouses.SubCost(cost))
            {
                slots[i].GetComponent <ShipBuildingsRenderer>().RenderShip(type, busySlot.time);
            }
        }
    }
        /// <summary>
        /// Maps the ship time data.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>Gets the ship time</returns>
        internal static async Task<ShipTime> MapShipTimeData(SqlDataReader dataReader)
        {
            var shipTime = new ShipTime();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    shipTime.ShipId = dataReader.Int16Field(ShipId).ToString();
                    shipTime.UtcOffset = dataReader.Int16Field(UtcOffset);
                }
            }

            return shipTime;
        }
Beispiel #3
0
    public void ProcessBuilding()
    {
        int i = 0;

        foreach (var item in CostructShips.Keys.ToList())
        {
            ShipTime temp = CostructShips[item];
            if (temp.type != null)
            {
                temp.time -= 1;
                if (temp.time <= 0)
                {
                    FinishBuildingShip(item, temp.type);
                    temp.type = null;
                    temp.time = 0;
                }
                CostructShips[item] = temp;
                slots[i].GetComponent <ShipBuildingsRenderer>().RenderShip(CostructShips[item].type, CostructShips[item].time);
            }
            i++;
        }
    }
 /// <summary>
 /// Function to map ship time detail.
 /// </summary>
 /// <param name="shipTimeDetailValue">Ship time detail</param>
 private void Map(ShipTime shipTimeDetailValue)
 {
     if (shipTimeDetailValue != null)
     {
         this.shipTimeDetail = shipTimeDetailValue;
     }
 }
 /// <summary>
 /// Setups the data.
 /// </summary>
 private void SetupData()
 {
     this.shipTime = new ShipTime { ShipId = "5", UtcOffset = "5" };
     this.shipTimeRepository.Setup(data => data.GetAsync("5")).Returns(Task.FromResult(this.shipTime));
 }