Beispiel #1
0
        public async Task <IResponse <BookResponse> > BuyAsync(BuyOption buyOption)
        {
            try
            {
                var partnerId = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.PartnerId);
                var password  = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.Password);
                var cityId    = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.CityId);
                var parkId    = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.ParkId);

                TicketBookSoapClient ticketBookSoapClient = new TicketBookSoapClient(TicketBookSoapClient.EndpointConfiguration.TicketBookSoap);
                long[]   visitorTypeId   = new long[10];
                string[] visitorTypeDesc = new string[10];
                string[] visitorName     = new string[10];
                string[] visitorGender   = new string[10];
                long[]   visitorAge      = new long[10];

                for (int i = 0; i < 10; i++)
                {
                    visitorTypeDesc[i] = visitorName[i] = visitorGender[i] = string.Empty;
                }

                Buy_Out buyOut = await ticketBookSoapClient.BuyAsync(Convert.ToInt64(parkId), partnerId, password, Convert.ToInt64(buyOption.TransactionId), buyOption.PayType, buyOption.PayConfNo, buyOption.Remarks, buyOption.MobileNo, buyOption.VisitDate, buyOption.ShiftId, buyOption.OrderId, buyOption.OrderRef, buyOption.MTR, buyOption.TransactionId, buyOption.RRN, buyOption.PayAuthId).ConfigureAwait(false);

                return(GetResponse(true, AutoMapper.Mapper.Map <List <BookResponse> >(buyOut).FirstOrDefault()));
            }
            catch (Exception ex)
            {
                _logger.Log(LogCategory.Error, new Exception("Failed to book tickets", ex));
                return(GetResponse(false, null));
            }
        }
Beispiel #2
0
    private List <BuyOption> GetGlobalOptions()
    {
        var global = new List <BuyOption>();

        var town = new BuyOption();

        town.optionName  = "Town";
        town.function    = "build.town";
        town.sprite      = ImageManager.GetSprite("town");
        town.peopleReq   = 100;
        town.leatherCost = 100;
        town.woodCost    = 500;
        town.foodCost    = 500;
        town.stoneCost   = 900;

        global.Add(town);

        return(global);
    }
Beispiel #3
0
    private BuyOption CreateOption(BuyOption option, GameObject reference)
    {
        var newObject = Instantiate(reference, this.transform, true);

        var optionComponent = newObject.GetComponent <BuyOption>();

        optionComponent.woodCost     = option.woodCost;
        optionComponent.foodCost     = option.foodCost;
        optionComponent.stoneCost    = option.stoneCost;
        optionComponent.peopleReq    = option.peopleReq;
        optionComponent.leatherCost  = option.leatherCost;
        optionComponent.image.sprite = option.sprite;
        optionComponent.optionName   = option.optionName;
        optionComponent.function     = option.function;

        newObject.transform.parent = transform;

        newObject.SetActive(true);

        return(optionComponent);
    }
Beispiel #4
0
    private List <BuyOption> GetTownOptions()
    {
        var townOptions = new List <BuyOption>();

        var house = new BuyOption();

        house.optionName  = "House";
        house.function    = "build.house";
        house.sprite      = ImageManager.GetSprite("house");
        house.leatherCost = 1;
        house.woodCost    = 7;
        house.stoneCost   = 3;

        var storage = new BuyOption();

        storage.optionName  = "Storage";
        storage.function    = "build.storage";
        storage.sprite      = ImageManager.GetSprite("storage");
        storage.leatherCost = 3;
        storage.woodCost    = 7;
        storage.stoneCost   = 10;

        var quarry = new BuyOption();

        quarry.optionName = "Quarry";
        quarry.function   = "build.quarry";
        quarry.sprite     = ImageManager.GetSprite("quarry");
        quarry.woodCost   = 15;
        quarry.stoneCost  = 10;

        townOptions.Add(house);
        townOptions.Add(storage);
        townOptions.Add(quarry);

        return(townOptions);
    }
Beispiel #5
0
 public void BuyOptionChoosen(BuyOption option)
 {
     onBuyOptionChoosen?.Invoke(option);
 }
Beispiel #6
0
 void Start()
 {
     EventBus.instance.onBuyOptionChoosen += (option) => lastOption = option;
     EventBus.instance.onBuildingCanceled += UndoneLastBuyOption;
 }