public ShopExperience(Sprite that) { var currentped = default(IPhysicalUnit); var shopcontent = new ApplicationCanvas(); var sb = new Soundboard(); #region GiveMeWhatIWant Action GiveMeWhatIWant = delegate { shopcontent.bg_ammo.Fill = Brushes.Green; shopcontent.bg_shotgun.Fill = Brushes.Green; sb.snd_SelectWeapon.play(); shopcontent.t2o.Opacity = 0.1; (currentped as PhysicalPed).With( ped => { ped.visual.StandWithVisibleGun = true; } ); }; #endregion #region BuyAmmo shopcontent.BuyAmmo += delegate { Console.WriteLine("BuyAmmo"); // BuyAmmo //facebookOAuthConnectPopup: { facebookOAuthConnectPopup_window = _blank } //after facebookOAuthConnectPopup //still in window: { Right = 739, Left = 675 } //{ zombie_forceA = 4.867357484065154 } //facebookOAuthConnectPopup callback { connectUserId = fb1527339800, access_token = AAADLSABgZCZC0BAOroZC3jsNhsgRVFhBK4VcAT19uePwd2iZBKX8ZCVwtdu8ZBhtmU9bH6nMJHO0qJ6I5dzvhw9Ty1kt542zpH2BZCMKKPI0wZDZD, facebookuserid = 1527339800 } //at callback //BuyAmmo { facebookuserid = 1527339800, Length = 1 } //{ item = [playerio.VaultItem][itemKey="Shotgun3", id="403939388", purchaseDate=Mon Mar 11 21:32:08 GMT+0200 2013] = { //FreelyGivable:true //PriceUSD:99 //} } //set facebookOAuthConnectPopupItems_cache sb.snd_click.play( sndTransform: new ScriptCoreLib.ActionScript.flash.media.SoundTransform(0.5) ); #if FFACEBOOK that.facebookOAuthConnectPopupItems( (Client xclient, string access_token, string facebookuserid, object[] items) => { Console.WriteLine("BuyAmmo " + new { facebookuserid, xclient.payVault.items.Length }); #region itemKey_exists var itemKey = "Shotgun3"; var itemKey_exists = false; foreach (var item in items) { var dyn = new DynamicContainer { Subject = item }; var dyn_itemKey = (string)dyn["itemKey"]; Console.WriteLine(new { item }); if (dyn_itemKey == itemKey) { itemKey_exists = true; } } if (itemKey_exists) { GiveMeWhatIWant(); return; } #endregion // facebookOAuthConnectPopup callback { connectUserId = fb1527339800, access_token = AAADLSABgZCZC0BAOroZC3jsNhsgRVFhBK4VcAT19uePwd2iZBKX8ZCVwtdu8ZBhtmU9bH6nMJHO0qJ6I5dzvhw9Ty1kt542zpH2BZCMKKPI0wZDZD, facebookuserid = 1527339800 } //BuyAmmo { facebookuserid = 1527339800, Length = 1 } //{ item = [playerio.VaultItem][itemKey="Shotgun3", id="403939388", purchaseDate=Mon Mar 11 21:32:08 GMT+0200 2013] = { //FreelyGivable:true //PriceUSD:99 //} } } ); #endif }; #endregion #region BuyShotgun shopcontent.BuyShotgun += delegate { Console.WriteLine("BuyShotgun"); sb.snd_click.play( sndTransform: new ScriptCoreLib.ActionScript.flash.media.SoundTransform(0.5) ); // that.facebookOAuthConnectPopupItems( // (Client xclient, string access_token, string facebookuserid, object[] items) => // { // Console.WriteLine("BuyShotgun " + new { facebookuserid, xclient.payVault.items.Length }); // var itemKey = "Shotgun3"; // var BuyAnyway = false; // if (BuyAnyway) // { // } // else // { // #region itemKey_exists // var itemKey_exists = false; // foreach (var item in items) // { // var dyn = new DynamicContainer { Subject = item }; // var dyn_itemKey = (string)dyn["itemKey"]; // Console.WriteLine(new { item }); // if (dyn_itemKey == itemKey) // itemKey_exists = true; // } // if (itemKey_exists) // { // GiveMeWhatIWant(); // return; // } // #endregion // } // Console.WriteLine("before getBuyDirectInfo"); // //// Gets information about how to make a direct item purchase with the specified PayVault provider. // //that.getBuyDirectInfo( // // xclient, // // facebookuserid, // // item_name: "Operation Heat Zeeker - Shotgun", // // itemKey: itemKey, // // yield_paypalurl: uri => // // { // // Console.WriteLine("at getBuyDirectInfo"); // // shopcontent.bg_shotgun.Fill = Brushes.Red; // // uri.NavigateTo(); // // } // //); // } //); }; #endregion ShopEnter = ped => { currentped = ped; shopcontent.AttachToContainer(that); shopcontent.AutoSizeTo(that.stage); }; shopcontent.Close += delegate { if (currentped == null) { return; } currentped = null; ScriptCoreLib.ActionScript.Extensions.CommonExtensions.Orphanize( ScriptCoreLib.ActionScript.Extensions.AvalonExtensions.ToSprite(shopcontent) ); }; ShopExit = delegate { if (currentped == null) { return; } currentped = null; ScriptCoreLib.ActionScript.Extensions.CommonExtensions.Orphanize( ScriptCoreLib.ActionScript.Extensions.AvalonExtensions.ToSprite(shopcontent) ); }; }
public ShopExperience(Sprite that) { var currentped = default(IPhysicalUnit); var shopcontent = new ApplicationCanvas(); var sb = new Soundboard(); #region GiveMeWhatIWant Action GiveMeWhatIWant = delegate { shopcontent.bg_ammo.Fill = Brushes.Green; shopcontent.bg_shotgun.Fill = Brushes.Green; sb.snd_SelectWeapon.play(); shopcontent.t2o.Opacity = 0.1; (currentped as PhysicalPed).With( ped => { ped.visual.StandWithVisibleGun = true; } ); }; #endregion #region BuyAmmo shopcontent.BuyAmmo += delegate { Console.WriteLine("BuyAmmo"); // BuyAmmo //facebookOAuthConnectPopup: { facebookOAuthConnectPopup_window = _blank } //after facebookOAuthConnectPopup //still in window: { Right = 739, Left = 675 } //{ zombie_forceA = 4.867357484065154 } //facebookOAuthConnectPopup callback { connectUserId = fb1527339800, access_token = AAADLSABgZCZC0BAOroZC3jsNhsgRVFhBK4VcAT19uePwd2iZBKX8ZCVwtdu8ZBhtmU9bH6nMJHO0qJ6I5dzvhw9Ty1kt542zpH2BZCMKKPI0wZDZD, facebookuserid = 1527339800 } //at callback //BuyAmmo { facebookuserid = 1527339800, Length = 1 } //{ item = [playerio.VaultItem][itemKey="Shotgun3", id="403939388", purchaseDate=Mon Mar 11 21:32:08 GMT+0200 2013] = { //FreelyGivable:true //PriceUSD:99 //} } //set facebookOAuthConnectPopupItems_cache sb.snd_click.play( sndTransform: new ScriptCoreLib.ActionScript.flash.media.SoundTransform(0.5) ); #if FFACEBOOK that.facebookOAuthConnectPopupItems( (Client xclient, string access_token, string facebookuserid, object[] items) => { Console.WriteLine("BuyAmmo " + new { facebookuserid, xclient.payVault.items.Length }); #region itemKey_exists var itemKey = "Shotgun3"; var itemKey_exists = false; foreach (var item in items) { var dyn = new DynamicContainer { Subject = item }; var dyn_itemKey = (string)dyn["itemKey"]; Console.WriteLine(new { item }); if (dyn_itemKey == itemKey) itemKey_exists = true; } if (itemKey_exists) { GiveMeWhatIWant(); return; } #endregion // facebookOAuthConnectPopup callback { connectUserId = fb1527339800, access_token = AAADLSABgZCZC0BAOroZC3jsNhsgRVFhBK4VcAT19uePwd2iZBKX8ZCVwtdu8ZBhtmU9bH6nMJHO0qJ6I5dzvhw9Ty1kt542zpH2BZCMKKPI0wZDZD, facebookuserid = 1527339800 } //BuyAmmo { facebookuserid = 1527339800, Length = 1 } //{ item = [playerio.VaultItem][itemKey="Shotgun3", id="403939388", purchaseDate=Mon Mar 11 21:32:08 GMT+0200 2013] = { //FreelyGivable:true //PriceUSD:99 //} } } ); #endif }; #endregion #region BuyShotgun shopcontent.BuyShotgun += delegate { Console.WriteLine("BuyShotgun"); sb.snd_click.play( sndTransform: new ScriptCoreLib.ActionScript.flash.media.SoundTransform(0.5) ); // that.facebookOAuthConnectPopupItems( // (Client xclient, string access_token, string facebookuserid, object[] items) => // { // Console.WriteLine("BuyShotgun " + new { facebookuserid, xclient.payVault.items.Length }); // var itemKey = "Shotgun3"; // var BuyAnyway = false; // if (BuyAnyway) // { // } // else // { // #region itemKey_exists // var itemKey_exists = false; // foreach (var item in items) // { // var dyn = new DynamicContainer { Subject = item }; // var dyn_itemKey = (string)dyn["itemKey"]; // Console.WriteLine(new { item }); // if (dyn_itemKey == itemKey) // itemKey_exists = true; // } // if (itemKey_exists) // { // GiveMeWhatIWant(); // return; // } // #endregion // } // Console.WriteLine("before getBuyDirectInfo"); // //// Gets information about how to make a direct item purchase with the specified PayVault provider. // //that.getBuyDirectInfo( // // xclient, // // facebookuserid, // // item_name: "Operation Heat Zeeker - Shotgun", // // itemKey: itemKey, // // yield_paypalurl: uri => // // { // // Console.WriteLine("at getBuyDirectInfo"); // // shopcontent.bg_shotgun.Fill = Brushes.Red; // // uri.NavigateTo(); // // } // //); // } //); }; #endregion ShopEnter = ped => { currentped = ped; shopcontent.AttachToContainer(that); shopcontent.AutoSizeTo(that.stage); }; shopcontent.Close += delegate { if (currentped == null) return; currentped = null; ScriptCoreLib.ActionScript.Extensions.CommonExtensions.Orphanize( ScriptCoreLib.ActionScript.Extensions.AvalonExtensions.ToSprite(shopcontent) ); }; ShopExit = delegate { if (currentped == null) return; currentped = null; ScriptCoreLib.ActionScript.Extensions.CommonExtensions.Orphanize( ScriptCoreLib.ActionScript.Extensions.AvalonExtensions.ToSprite(shopcontent) ); }; }