private void OnSuccessedShortening(WebAPI.ResponseData response)
    {
        int num = 0;
        FacilityBuildShorteningResult facilityBuildShorteningResult = response as FacilityBuildShorteningResult;

        if (facilityBuildShorteningResult != null)
        {
            num = facilityBuildShorteningResult.num;
            UserFacility userFacility = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID);

            FacilityM facilityMaster = FarmDataManager.GetFacilityMaster(userFacility.facilityId);
            FarmUtility.PayCost(facilityMaster.shorteningAssetCategoryId1, num.ToString());
        }
        else
        {
            FacilityUpgradeShorteningResult facilityUpgradeShorteningResult = response as FacilityUpgradeShorteningResult;
            if (facilityUpgradeShorteningResult != null)
            {
                num = facilityUpgradeShorteningResult.num;
                UserFacility userFacility2 = Singleton <UserDataMng> .Instance.GetUserFacility(this.farmObject.userFacilityID);

                FacilityUpgradeM facilityUpgradeMaster = FarmDataManager.GetFacilityUpgradeMaster(userFacility2.facilityId, userFacility2.level);
                FarmUtility.PayCost(facilityUpgradeMaster.shorteningAssetCategoryId1, num.ToString());
            }
        }
        if (0 >= num)
        {
            CMD_ChangePOP_STONE cmd_ChangePOP_STONE = UnityEngine.Object.FindObjectOfType <CMD_ChangePOP_STONE>();
            if (null != cmd_ChangePOP_STONE)
            {
                cmd_ChangePOP_STONE.SetCloseAction(new Action <int>(this.OpenNoNeedShortening));
            }
        }
        this.SuccessShortening();
    }
예제 #2
0
 private byte[] MasterDataToBinary(WebAPI.ResponseData masterData)
 {
     byte[] result = null;
     try
     {
         TypeSerializeHelper.DataToBytes <WebAPI.ResponseData>(masterData, out result);
     }
     catch
     {
         global::Debug.LogWarning("MasterDataのSerializeでエラーが発生しました");
     }
     return(result);
 }
 public static void SetResponseData(WebAPI.ResponseData response)
 {
     if (response == null)
     {
         return;
     }
     if (typeof(GameWebAPI.RespDataMA_GetFacilityM) == response.GetType())
     {
         GameWebAPI.RespDataMA_GetFacilityM respDataMA_GetFacilityM = (GameWebAPI.RespDataMA_GetFacilityM)response;
         FarmDataManager.facilityMaster = respDataMA_GetFacilityM.facilityM.Where((FacilityM x) => int.Parse(x.facilityId) != 6).ToList <FacilityM>();
     }
     else if (typeof(GameWebAPI.RespDataMA_GetFacilityKeyM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityKeyM>(ref FarmDataManager.facilityKeyMaster);
         FarmDataManager.facilityKeyMaster.AddRange(((GameWebAPI.RespDataMA_GetFacilityKeyM)response).facilityKeyM);
     }
     else if (typeof(GameWebAPI.RespDataMA_GetFacilityUpgradeM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityUpgradeM>(ref FarmDataManager.facilityUpgradeMaster);
         FarmDataManager.facilityUpgradeMaster.AddRange(((GameWebAPI.RespDataMA_GetFacilityUpgradeM)response).facilityUpgradeM);
     }
     else if (typeof(GameWebAPI.RespDataMA_GetFacilityMeatFieldM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityMeatFieldM>(ref FarmDataManager.facilityMeatFieldMaster);
         FarmDataManager.facilityMeatFieldMaster.AddRange(((GameWebAPI.RespDataMA_GetFacilityMeatFieldM)response).facilityMeatFieldM);
     }
     else if (typeof(GameWebAPI.RespDataMA_GetFacilityWarehouseM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityWarehouseM>(ref FarmDataManager.facilityWarehouseMaster);
         FarmDataManager.facilityWarehouseMaster.AddRange(((GameWebAPI.RespDataMA_GetFacilityWarehouseM)response).facilityWarehouseM);
     }
     else if (typeof(GameWebAPI.RespDataMA_GetFacilityExpUpM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityExpUpM>(ref FarmDataManager.facilityExpUpMaster);
         FarmDataManager.facilityExpUpMaster.AddRange(((GameWebAPI.RespDataMA_GetFacilityExpUpM)response).facilityExpUpM);
     }
     else if (typeof(GameWebAPI.RespDataMA_GetFacilityRestaurantM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityRestaurantM>(ref FarmDataManager.facilityRestaurantMaster);
         FarmDataManager.facilityRestaurantMaster.AddRange(((GameWebAPI.RespDataMA_GetFacilityRestaurantM)response).facilityRestaurantM);
     }
     else if (typeof(GameWebAPI.RespDataMA_GetFacilityHouseM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityHouseM>(ref FarmDataManager.facilityHouseMaster);
         FarmDataManager.facilityHouseMaster.AddRange(((GameWebAPI.RespDataMA_GetFacilityHouseM)response).facilityHouseM);
     }
     else if (typeof(GameWebAPI.RespDataMA_FacilityConditionM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityConditionM>(ref FarmDataManager.facilityConditionMaster);
         FarmDataManager.facilityConditionMaster.AddRange(((GameWebAPI.RespDataMA_FacilityConditionM)response).facilityConditionM);
     }
     else if (typeof(GameWebAPI.RespDataMA_FacilityExtraEffectM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityExtraEffectM>(ref FarmDataManager.facilityExtraEffectMaster);
         FarmDataManager.facilityExtraEffectMaster.AddRange(((GameWebAPI.RespDataMA_FacilityExtraEffectM)response).facilityExtraEffectM);
     }
     else if (typeof(GameWebAPI.RespDataMA_FacilityExtraEffectLevelM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityExtraEffectLevelM>(ref FarmDataManager.facilityExtraEffectLevelMaster);
         FarmDataManager.facilityExtraEffectLevelMaster.AddRange(((GameWebAPI.RespDataMA_FacilityExtraEffectLevelM)response).facilityExtraEffectLevelM);
     }
     else if (typeof(GameWebAPI.RespDataMA_GetFacilityChipM) == response.GetType())
     {
         FarmDataManager.InitList <FacilityChipM>(ref FarmDataManager.facilityChipFieldMaster);
         FarmDataManager.facilityChipFieldMaster.AddRange(((GameWebAPI.RespDataMA_GetFacilityChipM)response).facilityChipM);
     }
 }