Пример #1
0
    public void refreshJoystickStatus(ShopContent content)
    {
        int idx = 0;

        switch (content.Name)
        {
        case "The Mecha":
            idx = 0;
            break;

        case "The Round Table":
            idx = 1;
            break;
        }

        joystickPriceLabel[idx].SetActive(true);
        string btnText = joystickBuyButton [idx].transform.GetChild(0).GetComponent <Text> ().text;

        if (btnText == buyString)
        {
            btnText = equipString;
        }
        else if (btnText == equipString)
        {
            btnText = equippedString;
            joystickPriceLabel[idx].SetActive(false);
        }
    }
Пример #2
0
    private void setShopItem(Transform trChild, string a)
    {
        if (trChild)
        {
            ShopContent content = trChild.gameObject.GetComponent <ShopContent> ();

            if (a == "powerup")
            {
                int    iAmount = 0;
                string sKey    = content.name + "_Amount";
                if (PlayerPrefs.HasKey(sKey))
                {
                    iAmount = PlayerPrefs.GetInt(sKey);
                }
                iAmount += content.Amount;
                PlayerPrefs.SetInt(sKey, iAmount);
                GUI_InGame_New.instance.refreshInGamePowerUpInfo(content);
            }
            else if (a == "claw")
            {
                GUI_Shop_New.instance.refreshClawStatus(content);
                PlayerPrefs.SetInt(a + "." + content.uniqueID, 1);
            }
            else if (a == "joystick")
            {
                GUI_Shop_New.instance.refreshJoystickStatus(content);
                PlayerPrefs.SetInt(a + "." + content.uniqueID, 1);
            }
        }
        PlayerPrefs.Save();
    }
Пример #3
0
    private static void OnRetrieveProductsFinised(BillingResult result)
    {
        AndroidInAppPurchaseManager.ActionRetrieveProducsFinished -= OnRetrieveProductsFinised;


        if (result.isSuccess)
        {
            foreach (GoogleProductTemplate tpl in AndroidInAppPurchaseManager.instance.inventory.products)
            {
                for (int i = 0; i < GUI_Shop.GetInstance().containerShopCoins.transform.childCount; i++)
                {
                    ShopContent content = GUI_Shop.GetInstance().containerShopCoins.transform.GetChild(i).gameObject.GetComponent <ShopContent>();
                    if (tpl.SKU.Equals(content.uniqueID))
                    {
                        GameManager.SetNGUILabel(content.transform.Find("Label Price"), tpl.price);
                        Transform trButtonBuy = content.transform.Find("ButtonBuy");
                        if (trButtonBuy)
                        {
                            trButtonBuy.gameObject.SetActive(true);
                        }
                        break;
                    }
                }
            }
        }
        else
        {
            //AndroidMessage.Create("Connection Responce", result.response.ToString() + " " + result.message);
        }

        Debug.Log("Connection Response: " + result.response.ToString() + " " + result.message);
    }
Пример #4
0
    public void refreshInGamePowerUpInfo(ShopContent content)
    {
        string sKey    = content.Name + "_Amount";
        int    iAmount = PlayerPrefs.GetInt(sKey, 0);

        int idx = 0;

        if (content.Name == GameManager.powerUpName_Bomb)
        {
            idx = 0;
        }
        else if (content.Name == GameManager.powerUpName_LuckyCharm)
        {
            idx = 1;
        }
        else if (content.Name == GameManager.powerUpName_LaserPointer)
        {
            idx = 2;
        }
        else if (content.Name == GameManager.powerUpName_WizardWand)
        {
            idx = 3;
        }
        else if (content.Name == GameManager.powerUpName_BlackHole)
        {
            idx = 4;
        }

        powerupObj[idx].GetChild(0).GetComponent <Text>().text = iAmount.ToString();
    }
Пример #5
0
        public ActionResult ProductDetail(string id)
        {
            if (id == null)
            {
                id = "";
            }
            var model = db.Products.Where(m => m.product_no == id).FirstOrDefault();

            //List<string> color_list = ShopContent.GetColorList(model.product_no);
            //List<string> size_list = ShopContent.GetSizeList(model.product_no);
            if (model == null)
            {
                return(RedirectToAction("Shop", "Home"));
            }

            string categoty_no   = "";
            string categoty_name = "";

            ShopContent.GetCategoryByProductNo(model.product_no, ref categoty_no, ref categoty_name);
            ViewBag.CategoryNo   = categoty_no;
            ViewBag.CategoryName = categoty_name;
            //ViewBag.ColorList = color_list;
            //ViewBag.SizeList = size_list;


            return(View(model));
        }
Пример #6
0
    private void setShopItem(Transform trChild, string a)
    {
        if (trChild)
        {
            ShopContent content = trChild.gameObject.GetComponent <ShopContent>();

            if (a == "powerup")
            {
                int    iAmount = 0;
                string sKey    = content.name + "_Amount";
                if (PlayerPrefs.HasKey(sKey))
                {
                    iAmount = PlayerPrefs.GetInt(sKey);
                }
                iAmount += content.Amount;
                PlayerPrefs.SetInt(sKey, iAmount);
                guiIngame.RefreshPowerUpsInfo();
            }
            else
            {
                Transform trButtonBuy = content.transform.Find("ButtonBuy");
                GameManager.SetNGUILabel(trButtonBuy.transform.Find("Label"), "Equip");
                PlayerPrefs.SetInt(a + "." + content.uniqueID, 1);
            }
        }
        PlayerPrefs.Save();
    }
Пример #7
0
        public ActionResult ChangeStatus(int id = 0)
        {
            string str_status = "ON";

            using (ZONYEntities db = new ZONYEntities())
            {
                var model = db.Orders.Where(m => m.rowid == id).FirstOrDefault();
                if (model != null)
                {
                    str_status = model.order_status;
                }

                var           selectList = new List <SelectListItem>();
                List <Status> lists      = ShopContent.GetStatusList();
                foreach (var item in lists)
                {
                    SelectListItem list = new SelectListItem();
                    list.Value = item.mno;
                    list.Text  = item.mname;
                    selectList.Add(list);
                }
                //預設選擇哪一筆
                selectList.Where(m => m.Value == str_status).First().Selected = true;

                ViewBag.SelectList = selectList;
                return(View(model));
            }
        }
Пример #8
0
    public void refreshClawStatus(ShopContent content)
    {
        int idx = 0;

        switch (content.Name)
        {
        case "The Red Claw":
            idx = 0;
            break;

        case "The Metallic Claw":
            idx = 1;
            break;
        }

        clawPriceLabel[idx].SetActive(true);
        string btnText = clawBuyButton [idx].transform.GetChild(0).GetComponent <Text> ().text;

        if (btnText == buyString)
        {
            btnText = equipString;
        }
        else if (btnText == equipString)
        {
            btnText = equippedString;
            clawPriceLabel[idx].SetActive(false);
        }
    }
Пример #9
0
    public void SetIngredient(ShopContent shopContent, IngredientSO ingredientSO)
    {
        _shopContent = shopContent;


        ingredient  = ingredientSO;
        _name.text  = ingredientSO.name;
        _isSelected = ingredientSO.isSelected;


        _ingredientImage.sprite = ingredientSO.sprite;
        _ingredientImage.gameObject.SetActive(true);

        if (ingredientSO.isAlwaysActive)
        {
            _isSelected             = true;
            ingredientSO.isSelected = true;
            ingredientSO.isLock     = false;
        }


        if (ingredientSO.isLock)
        {
            _ingredientPanelImage.sprite = _lockSprite;
            _ingredientImage.gameObject.SetActive(false);
        }

        _checkBox.SetActive(_isSelected);
    }
Пример #10
0
        public ActionResult Edit(Users models)
        {
            bool status = false;

            ModelState.Remove("Password"); //忽略 Password 驗證
            ModelState.Remove("role_no");  //忽略 role_no 驗證
            if (ModelState.IsValid)
            {
                using (ZONYEntities db = new ZONYEntities())
                {
                    if (models.rowid > 0)
                    {
                        //Edit
                        var users = db.Users.Where(m => m.rowid == models.rowid).FirstOrDefault();
                        if (users != null)
                        {
                            users.isvarify = ShopContent.BoolToInteger(models.bool_isvarify);
                            users.mno      = models.mno;
                            users.mname    = models.mname;
                            users.email    = models.email;
                            users.birthday = models.birthday;
                            users.remark   = models.remark;
                        }
                    }
                    else
                    {
                        //Save
                        models.role_no     = UserAccount.UserRoleNo;
                        models.varify_code = UserAccount.GetNewVarifyCode(); //產生驗證碼
                        if (UserAccount.UserStatus < 2)
                        {
                            models.isvarify = UserAccount.UserStatus;
                        }
                        else
                        {
                            models.isvarify = ShopContent.BoolToInteger(models.bool_isvarify);
                        }

                        db.Users.Add(models);
                    }
                    try
                    {
                        db.Configuration.ValidateOnSaveEnabled = false;
                        db.SaveChanges();
                        db.Configuration.ValidateOnSaveEnabled = true;
                        status = true;
                    }
                    catch (Exception ex)
                    {
                        string str_message = ex.Message;
                        status = false;
                    }
                }
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
Пример #11
0
 public void SwitchToBuyContent(bool force = false)
 {
     if (force || !BuyContent.IsActive())
     {
         currentContent = BuyContent;
         SellContent.SetActive(false);
         BuyContent.SetActive(true);
         RefreshContent();
     }
 }
Пример #12
0
    public void onClickBuyButton(GameObject button)
    {
        Gamestate_Gameplay gs = GameObject.Find("Gamestate").GetComponent <Gamestate_Gameplay> ();

        if (gs == null)
        {
            return;
        }

        ShopContent content = button.GetComponent <ShopContent> ();

        if (content.type == ShopContentType.IAP)
        {
            if (PlayerPrefs.HasKey("joystick." + content.uniqueID) == true)
            {
                PlayerPrefs.SetString("playerjoy", content.uniqueID);
                gs.SetJoystick(content.uniqueID);
                refreshJoystickStatus(content);
            }
            else if (PlayerPrefs.HasKey("claw." + content.uniqueID) == true)
            {
                PlayerPrefs.SetString("playerclaw", content.uniqueID);
                gs.SetClaw(content.uniqueID);
                refreshClawStatus(content);
            }
            else
            {
                currShopContent = content;
                AndroidInAppPurchaseManager.instance.purchase(currShopContent.uniqueID);
                                #if UNITY_EDITOR
                Debug.Log("purchased " + currShopContent.Name);
                                #endif
            }
        }
        else if (content.type == ShopContentType.PowerUp)
        {
            int currCoins = GameManager.GEMUCOINS;

            if (currCoins - content.Price >= 0)
            {
                currShopContent = content;
                Debug.Log("purchased " + currShopContent.Name);
                //show dialog box buy confirmation
            }
            else
            {
                //show dialog box not enough coins
                Debug.Log("not enough coins");
            }
        }

        PlayerPrefs.Save();
    }
Пример #13
0
        public async Task <IActionResult> CreateShopContent(ShopContent shopContent)
        {
            var shops = await dbContext.Shops.ToListAsync();

            ViewBag.Shops = shops;

            await dbContext.ShopContents.AddAsync(shopContent);

            await dbContext.SaveChangesAsync();


            return(RedirectToAction("SeeAllShopContent"));
        }
Пример #14
0
        public ActionResult CategoryList(string id)
        {
            int int_id = 0;

            ViewBag.CategoryNo   = id;
            ViewBag.TypeName     = ShopContent.GetTypeName(id);
            ViewBag.CategoryName = ShopContent.GetCategoryName(id, ref int_id);
            var model = db.Products
                        .Where(m => m.categoryid == int_id)
                        .OrderBy(m => m.product_no)
                        .ToList();

            return(View(model));
        }
Пример #15
0
        public async Task <IActionResult> EditShopContent(ShopContent shopContent)
        {
            var shops = await dbContext.Shops.ToListAsync();

            ViewBag.Shops = shops;

            var edittedContent = await dbContext.ShopContents.FirstOrDefaultAsync(x => x.Id == shopContent.Id);

            var a = 5;

            edittedContent.CustomText = shopContent.CustomText;
            await dbContext.SaveChangesAsync();

            return(RedirectToAction("SeeAllShopContent"));
        }
Пример #16
0
 public ActionResult Reset(int id)
 {
     using (ZONYEntities db = new ZONYEntities())
     {
         var model = db.Users.Where(m => m.rowid == id).FirstOrDefault();
         if (model != null)
         {
             model.bool_isvarify = ShopContent.IntegerToBool(model.isvarify);
             return(View(model));
         }
         else
         {
             return(HttpNotFound());
         }
     }
 }
Пример #17
0
 public ActionResult ReturnProduct(int id = 0)
 {
     using (ZONYEntities db = new ZONYEntities())
     {
         var model = db.Orders.Where(m => m.rowid == id).FirstOrDefault();
         if (model != null)
         {
             if (ShopContent.IsUnCloseOrder(model.order_status))
             {
                 model.order_status = "RT";
                 model.order_closed = 1;
                 db.SaveChanges();
             }
         }
     }
     return(RedirectToAction("Index", "Orders", new { area = "Member", id = UserAccount.UserStatus, code = UserAccount.UserCode }));
 }
Пример #18
0
 public ActionResult ChangeStatus(Orders model)
 {
     using (ZONYEntities db = new ZONYEntities())
     {
         bool status = false;
         var  orders = db.Orders.Where(m => m.order_no == model.order_no).FirstOrDefault();
         if (orders != null)
         {
             orders.order_status   = model.order_status;
             orders.order_closed   = ShopContent.GetOrderClosed(model.order_status);
             orders.order_validate = ShopContent.GetOrderValidate(model.order_status);
             db.SaveChanges();
             status = true;
         }
         return(new JsonResult {
             Data = new { status = status }
         });
     }
 }
Пример #19
0
 public ActionResult Edit(int id = 0)
 {
     using (ZONYEntities db = new ZONYEntities())
     {
         if (id == 0)
         {
             Users new_model = new Users();
             new_model.role_no = UserAccount.UserRoleNo;
             if (UserAccount.UserStatus == 0)
             {
                 new_model.isvarify = 0; new_model.bool_isvarify = false;
             }
             else
             {
                 new_model.isvarify = 1; new_model.bool_isvarify = true;
             }
             return(View(new_model));
         }
         var models = db.Users.Where(m => m.rowid == id).FirstOrDefault();
         models.bool_isvarify = ShopContent.IntegerToBool(models.isvarify);
         return(View(models));
     }
 }
Пример #20
0
    // Use this for initialization
    public override void OnStart()
    {
        for (int i = 0; i < containerShopPowerups.transform.childCount; i++)
        {
            ShopContent content = containerShopPowerups.transform.GetChild(i).gameObject.GetComponent <ShopContent>();
            //Debug.LogError(content.name);
            GameManager.SetNGUILabel(content.transform.Find("Label Price"), content.Price.ToString() + " coins");
            GameManager.SetNGUILabel(content.transform.Find("Label Title"), content.Name);
        }

        for (int i = 0; i < containerShopFreeCoins.transform.childCount; i++)
        {
            if (i >= 1)
            {
                ShopContent content = containerShopFreeCoins.transform.GetChild(i).gameObject.GetComponent <ShopContent>();
                //Debug.LogError(content.name);
                //GameManager.SetNGUILabel(content.transform.Find("Label Price"),content.Price.ToString()+" GemuGold");
                GameManager.SetNGUILabel(content.transform.Find("Label Title"), content.Name);
            }
        }

        for (int i = 0; i < containerShopJoystick.transform.childCount; i++)
        {
            ShopContent content = containerShopJoystick.transform.GetChild(i).gameObject.GetComponent <ShopContent>();

            //GameManager.SetNGUILabel(content.transform.Find("Label Price"),content.Price.ToString()+" GemuGold");
            GameManager.SetNGUILabel(content.transform.Find("Label Title"), content.Name);

            Transform trButtonBuy = content.transform.Find("ButtonBuy");
            if (PlayerPrefs.HasKey("joystick." + content.uniqueID) == false && content.bFree == true)
            {
                PlayerPrefs.SetInt("joystick." + content.uniqueID, 1);
            }

            if (PlayerPrefs.HasKey("joystick." + content.uniqueID))
            {
                GameManager.SetNGUILabel(content.transform.Find("Label Price"), "");
                GameManager.SetNGUILabel(trButtonBuy.transform.Find("Label"), "Equip");
            }
        }

        for (int i = 0; i < containerShopClaw.transform.childCount; i++)
        {
            ShopContent content = containerShopClaw.transform.GetChild(i).gameObject.GetComponent <ShopContent>();

            //GameManager.SetNGUILabel(content.transform.Find("Label Price"),content.Price.ToString()+"Gold");
            GameManager.SetNGUILabel(content.transform.Find("Label Title"), content.Name);

            //PlayerPrefs.DeleteKey("claw."+content.uniqueID);
            Transform trButtonBuy = content.transform.Find("ButtonBuy");
            if (PlayerPrefs.HasKey("claw." + content.uniqueID) == false && content.bFree == true)
            {
                PlayerPrefs.SetInt("claw." + content.uniqueID, 1);
            }

            if (PlayerPrefs.HasKey("claw." + content.uniqueID))
            {
                GameManager.SetNGUILabel(content.transform.Find("Label Price"), "");
                GameManager.SetNGUILabel(trButtonBuy.transform.Find("Label"), "Equip");
            }
        }

//		for ( int i=0; i<containerShopCoins.transform.childCount ; i++ )
//		{
//			ShopContent content = containerShopCoins.transform.GetChild(i).gameObject.GetComponent<ShopContent>();
//			GameManager.SetNGUILabel(content.transform.Find("Label Price"),"");
//			Transform trButtonBuy = content.transform.Find("ButtonBuy");
//			if ( trButtonBuy )
//				trButtonBuy.gameObject.SetActive(false);
//
//		}
        AndroidInAppPurchaseManager.ActionProductPurchased += OnProductPurchased;
        AndroidInAppPurchaseManager.ActionProductConsumed  += OnProductConsumed;

        //listening for store initilaizing finish
        AndroidInAppPurchaseManager.ActionBillingSetupFinished += OnBillingConnected;
        AndroidInAppPurchaseManager.instance.loadStore();

        RefreshInfo();



        PlayerPrefs.Save();
    }
Пример #21
0
        public ActionResult Edit(Products models)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                using (ZONYEntities db = new ZONYEntities())
                {
                    int int_cate_id = 0;
                    if (models.rowid > 0)
                    {
                        //Edit
                        var products = db.Products.Where(m => m.rowid == models.rowid).FirstOrDefault();
                        if (products != null)
                        {
                            int_cate_id             = models.categoryid.GetValueOrDefault();
                            products.product_no     = models.product_no;
                            products.product_name   = models.product_name;
                            products.product_spec   = models.product_spec;
                            products.categoryid     = int_cate_id;
                            products.category_name  = ShopContent.GetCategoryName(int_cate_id);
                            products.istop          = (models.bool_istop) ? 1 : 0;
                            products.issale         = (models.bool_issale) ? 1 : 0;
                            products.issize         = (models.bool_issize) ? 1 : 0;
                            products.iscolor        = (models.bool_iscolor) ? 1 : 0;
                            products.isgame         = (models.bool_isgame) ? 1 : 0;
                            products.ismultiplayer  = (models.bool_ismultiplayer) ? 1 : 0;
                            products.price          = models.price;
                            products.start_count    = models.start_count;
                            products.browse_count   = models.browse_count;
                            products.vendor_no      = UserAccount.UserNo;
                            products.color_name     = models.color_name;
                            products.size_name      = models.size_name;
                            products.remark         = models.remark;
                            products.detail_remark  = models.detail_remark;
                            products.publisher      = models.publisher;
                            products.language_view  = models.language_view;
                            products.language_voice = models.language_voice;
                            products.player_num     = models.player_num;
                        }
                    }
                    else
                    {
                        //Save
                        models.vendor_no     = UserAccount.UserNo;
                        int_cate_id          = models.categoryid.GetValueOrDefault();
                        models.category_name = ShopContent.GetCategoryName(int_cate_id);
                        models.istop         = (models.bool_istop) ? 1 : 0;
                        models.issale        = (models.bool_issale) ? 1 : 0;
                        models.issize        = (models.bool_issize) ? 1 : 0;
                        models.iscolor       = (models.bool_iscolor) ? 1 : 0;
                        models.isgame        = (models.bool_isgame) ? 1 : 0;
                        models.ismultiplayer = (models.bool_ismultiplayer) ? 1 : 0;
                        db.Products.Add(models);
                    }
                    db.SaveChanges();
                    status = true;
                }
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
Пример #22
0
    public void OnClickShopContent()
    {
        UIButton button = UIButton.current;

        if (button == null)
        {
            return;
        }

        Gamestate_Gameplay gs = GameObject.Find("Gamestate").GetComponent <Gamestate_Gameplay>();

        if (gs == null)
        {
            return;
        }

        ShopContent content = button.transform.parent.gameObject.GetComponent <ShopContent> ();

        if (content.type == ShopContentType.IAP)
        {
            if (content.uniqueID == "freecoins")
            {
                GUI_Dialog.InsertStack(gemuFreeCoins.gameObject);
                //if ( GameDataManager.GetTimerToWatchAds() > GameDataManager.TIMER_TO_WATCH_ADS )
                //{
                //if (GameDataManager.PlayUnityVideoAd ()) {
                //	StartCoroutine(ShowingAds());
                //} else {
                //	gs.ShowDialogBox ("Info", "Please wait...", false, "", this.gameObject);
                //}
                //}
                //else
                //	gs.ShowDialogBox("Info","Please wait to watch the next ads.",false,"",this.gameObject);
            }
            else if (PlayerPrefs.HasKey("joystick." + content.uniqueID) == true)
            {
                PlayerPrefs.SetString("playerjoy", content.uniqueID);
                gs.SetJoystick(content.uniqueID);
                RefreshJoystickStatus();
            }
            else if (PlayerPrefs.HasKey("claw." + content.uniqueID) == true)
            {
                PlayerPrefs.SetString("playerclaw", content.uniqueID);
                gs.SetClaw(content.uniqueID);
                RefreshClawStatus();
            }
            else
            {
                currentShopContent = content;
                AndroidInAppPurchaseManager.instance.purchase(currentShopContent.uniqueID);
                //OnSuccessfulPurchase(currentShopContent.uniqueID);
            }
        }
        else if (content.type == ShopContentType.PowerUp)
        {
            int gemucoins = GameManager.GEMUCOINS;
            if (gemucoins - content.Price >= 0)
            {
                currentShopContent = content;
                gs.ShowDialogBox(content.Name, content.Desc + "\n\nDo you want to buy ?", true, "buypowerup", this.gameObject);
                //gs.achievementManager.OnAchievementEvent(AchievementType.PowerPlay,1);
            }
            else
            {
                gs.ShowDialogBox("Info", "Not enough coins", false, "confirm", this.gameObject);
            }
        }
        else if (content.type == ShopContentType.Claw)
        {
            if (PlayerPrefs.HasKey("claw." + content.uniqueID) == false)
            {
                int gemucoins = GameManager.GEMUCOINS;
                if (gemucoins - content.Price >= 0)
                {
                    //currentShopContent = content;
                    //gs.ShowDialogBox(content.Name,content.Desc+"Do you want to buy ?",true,"buyclaw",this.gameObject);
                    PlayerPrefs.SetString("playerclaw", content.uniqueID);
                    gs.SetClaw(content.uniqueID);
                    RefreshClawStatus();
                }
                else
                {
                    //gs.ShowDialogBox("Info","Not enough GemuGold",false,"confirm",this.gameObject);
                }
            }
            else
            {
                PlayerPrefs.SetString("playerclaw", content.uniqueID);
                gs.SetClaw(content.uniqueID);
                RefreshClawStatus();
            }
        }
        else if (content.type == ShopContentType.Joystick)
        {
            if (PlayerPrefs.HasKey("joystick." + content.uniqueID) == false)
            {
                int gemucoins = GameManager.GEMUCOINS;
                if (gemucoins - content.Price >= 0)
                {
                    //currentShopContent = content;
                    //gs.ShowDialogBox(content.Name,content.Desc+"Do you want to buy ?",true,"buyjoystick",this.gameObject);
                    PlayerPrefs.SetString("playerjoy", content.uniqueID);
                    gs.SetJoystick(content.uniqueID);
                    RefreshJoystickStatus();
                }
                else
                {
                    //gs.ShowDialogBox("Info","Not enough GemuGold",false,"confirm",this.gameObject);
                }
            }
            else
            {
                PlayerPrefs.SetString("playerjoy", content.uniqueID);
                gs.SetJoystick(content.uniqueID);
                RefreshJoystickStatus();
            }
        }
        else if (content.type == ShopContentType.FreeCoin)
        {
            int gemucoins = GameManager.GEMUCOINS;
            if (gemucoins - content.Price >= 0)
            {
                currentShopContent = content;
                gs.ShowDialogBox(content.Name, "Do you want to buy ?", true, "buyenergy", this.gameObject);
            }
            else
            {
                gs.ShowDialogBox("Info", "Not enough GemuGold", false, "confirm", this.gameObject);
            }
        }
        else
        {
            gs.ShowNotImplemented();
        }

        PlayerPrefs.Save();
    }
Пример #23
0
        public ActionResult Edit(int id = 0)
        {
            using (ZONYEntities db = new ZONYEntities())
            {
                var models = db.Products.Where(m => m.rowid == id).FirstOrDefault();

                //Category DropDownList
                string str_rowid    = "0";
                var    categoryList = new List <SelectListItem>();
                var    ageList      = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = "001", Text = "普遍級"
                    },
                    new SelectListItem()
                    {
                        Value = "002", Text = "保護級"
                    },
                    new SelectListItem()
                    {
                        Value = "003", Text = "輔導級"
                    },
                    new SelectListItem()
                    {
                        Value = "004", Text = "限制級"
                    },
                };
                var ZboxTypeList = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = "0", Text = "Zbox4"
                    },
                    new SelectListItem()
                    {
                        Value = "1", Text = "Zbox4/Zbox3"
                    },
                };


                List <Categorys> clists = db.Categorys.OrderBy(m => m.category_no).ToList();
                foreach (var item in clists)
                {
                    SelectListItem list = new SelectListItem();
                    list.Value = item.rowid.ToString();
                    list.Text  = ShopContent.GetCategoryName(item.rowid);
                    categoryList.Add(list);
                    if (id == 0)
                    {
                        if (str_rowid == "0")
                        {
                            str_rowid = item.rowid.ToString();
                        }
                    }
                }

                if (models != null)
                {
                    str_rowid = models.categoryid.ToString();
                }

                //預設選擇哪一筆
                categoryList.Where(m => m.Value == str_rowid).First().Selected = true;
                ViewBag.CategoryList = categoryList;
                ViewBag.AgeList      = ageList;
                ViewBag.ZboxTypeList = ZboxTypeList;

                if (id == 0)
                {
                    Products new_model = new Products();
                    new_model.size_name          = "";
                    new_model.color_name         = "";
                    new_model.remark             = "";
                    new_model.detail_remark      = "";
                    new_model.publisher          = "";
                    new_model.player_num         = "";
                    new_model.language_view      = "";
                    new_model.language_voice     = "";
                    new_model.start_count        = 5;
                    new_model.browse_count       = 0;
                    new_model.launchday          = DateTime.Today;
                    new_model.bool_istop         = false;
                    new_model.bool_issale        = true;
                    new_model.bool_iscolor       = false;
                    new_model.bool_issize        = false;
                    new_model.bool_isgame        = false;
                    new_model.bool_ismultiplayer = false;
                    return(View(new_model));
                }

                models.bool_istop         = (models.istop == 1);
                models.bool_issale        = (models.issale == 1);
                models.bool_iscolor       = (models.iscolor == 1);
                models.bool_issize        = (models.issize == 1);
                models.bool_isgame        = (models.isgame == 1);
                models.bool_ismultiplayer = (models.ismultiplayer == 1);
                return(View(models));
            }
        }
Пример #24
0
    public void OnSuccessfulPurchase(string SKU)
    {
        Gamestate gs = GameObject.Find("Gamestate").GetComponent <Gamestate>();

        if (gs)
        {
            //gs.achievementManager.OnAchievementEvent(AchievementType.ShopTime,1);
        }

        Transform trChild;

//		for ( int i=0; i<GUI_Shop.GetInstance().containerShopCoins.transform.childCount; i++ )
//		{
//			Transform trChild = GUI_Shop.GetInstance().containerShopCoins.transform.GetChild(i);
//			if ( trChild )
//			{
//				ShopContent content = trChild.gameObject.GetComponent<ShopContent>();
//				if ( content && content.type == ShopContentType.IAP )
//				{
//					if ( content.uniqueID == SKU )
//					{
//						gs.ShowDialogBox("Info","You bought "+content.Amount+" GemuGold",false,"",GUI_Shop.GetInstance().gameObject);
//						GameManager.GEMUCOINS += content.Amount;
//						PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin,GameManager.GEMUCOINS);
//						RefreshInfo();
//						/*GameDataManager.instance.SendPlayResult(
//							GameDataManager.instance.gameID.ToString(),"0",
//							GameManager.GEMUCOINS.ToString(),
//							GameManager.EXP.ToString(),
//							GameManager.getLevelValue().ToString());*/
//						//GL1Connector.GetInstance().PlayResult(this.gameObject,GameManager.getLevelValue().ToString(),"0",GameManager.EXP.ToString(),GameManager.GEMUCOINS.ToString());
//						GL1Connector.GetInstance().AddBalance(this.gameObject,"",content.Amount.ToString(),"","BUYGOLD"+content.Amount.ToString());
//						if ( gs.GetComponent<Gamestate_Gameplay>() )
//						{
//							Gamestate_Gameplay gsPlay = gs.GetComponent<Gamestate_Gameplay>();
//							gsPlay.RefreshAllInfo();
//						}
//						break;
//					}
//				}
//			}
//		}

        for (int k = 1; k < GUI_Shop.GetInstance().containerShopFreeCoins.transform.childCount - 2; k++)
        {
            trChild = GUI_Shop.GetInstance().containerShopFreeCoins.transform.GetChild(k);
            if (trChild)
            {
                ShopContent content = trChild.gameObject.GetComponent <ShopContent>();
                if (content && content.type == ShopContentType.IAP)
                {
                    if (content.uniqueID == SKU)
                    {
                        GameManager.FREECOINS += content.Amount;
                        gs.ShowDialogBox("Info", "You just bought " + content.Name, false, "confirm", this.gameObject);
                        RefreshInfo();

                        if (!PlayerPrefs.HasKey(PlayerPrefHandler.keyEnergyAch))
                        {
                            Social.ReportProgress(GPGSIds.achievement_the_spender, 100.0f, (bool success) => {
                                // handle success or failure
                                //gs.achievementManager.AddToFinalAchievementEvent();
                            });
                            PlayerPrefs.SetInt(PlayerPrefHandler.keyEnergyAch, 1);
                            PlayerPrefs.Save();
                        }

                        break;
                    }
                }
            }
        }

        for (int i = 1; i < GUI_Shop.GetInstance().containerShopJoystick.transform.childCount; i++)
        {
            trChild = GUI_Shop.GetInstance().containerShopJoystick.transform.GetChild(i);
            if (trChild)
            {
                ShopContent content = trChild.gameObject.GetComponent <ShopContent>();
                if (content && content.type == ShopContentType.IAP)
                {
                    if (content.uniqueID == SKU)
                    {
                        gs.ShowDialogBox("Info", "You just bought " + content.Name, false, "confirm", this.gameObject);
                        Transform trButtonBuy = content.transform.Find("ButtonBuy");
                        GameManager.SetNGUILabel(trButtonBuy.transform.Find("Label"), "Equip");

                        PlayerPrefs.SetInt("joystick." + content.uniqueID, 1);

                        break;
                    }
                }
            }
        }

        for (int j = 1; j < GUI_Shop.GetInstance().containerShopClaw.transform.childCount; j++)
        {
            trChild = GUI_Shop.GetInstance().containerShopClaw.transform.GetChild(j);
            if (trChild)
            {
                ShopContent content = trChild.gameObject.GetComponent <ShopContent>();
                if (content && content.type == ShopContentType.IAP)
                {
                    if (content.uniqueID == SKU)
                    {
                        gs.ShowDialogBox("Info", "You just bought " + content.Name, false, "confirm", this.gameObject);
                        Transform trButtonBuy = content.transform.Find("ButtonBuy");
                        GameManager.SetNGUILabel(trButtonBuy.transform.Find("Label"), "Equip");


                        PlayerPrefs.SetInt("claw." + content.uniqueID, 1);

                        break;
                    }
                }
            }
        }

        PlayerPrefs.Save();

        int playerClaw = 0, playerJoystick = 0;

        if (PlayerPrefs.HasKey("claw.clawmania.claw2"))
        {
            if (PlayerPrefs.GetInt("claw.clawmania.claw2") == 1)
            {
                playerClaw++;
            }
        }
        if (PlayerPrefs.HasKey("claw.clawmania.claw3"))
        {
            if (PlayerPrefs.GetInt("claw.clawmania.claw3") == 1)
            {
                playerClaw++;
            }
        }

        if (playerClaw >= 2)
        {
            Social.ReportProgress(GPGSIds.achievement_serious_grabber, 100.0f, (bool success) => {
                // handle success or failure
                //gs.achievementManager.AddToFinalAchievementEvent();
            });
        }

        if (PlayerPrefs.HasKey("claw.clawmania.joystick2"))
        {
            if (PlayerPrefs.GetInt("claw.clawmania.joystick2") == 1)
            {
                playerJoystick++;
            }
        }
        if (PlayerPrefs.HasKey("claw.clawmania.joystick3"))
        {
            if (PlayerPrefs.GetInt("claw.clawmania.joystick3") == 1)
            {
                playerJoystick++;
            }
        }
        if (playerJoystick >= 2)
        {
            Social.ReportProgress(GPGSIds.achievement_fancy_grabber, 100.0f, (bool success) => {
                // handle success or failure
                //gs.achievementManager.AddToFinalAchievementEvent();
            });
        }
    }