Пример #1
0
    void DisplayConfirm()
    {
        if (!isDisplayingConfirm)
        {
            GameObject confirmObject = (GameObject)Instantiate(ConfirmPrefab);
            confirmObject.transform.SetParent(Canvas.transform, false);
            ConfirmView    confirmView = (ConfirmView)(confirmObject.GetComponent("ConfirmView"));
            CardLevelSheet c           = cardLevelSheets[mediumCardView];
            confirmView.SetMessage("Are you sure you want to summon '" + c.ID + "'?");
            confirmView.AcceptDel  = DoAccept;
            confirmView.DeclineDel = DoDecline;
            isDisplayingConfirm    = true;
            selectedTileView       = currentTile;

            foreach (CardView cv in cards)
            {
                if (cv.Id == c.ID)
                {
                    cv.gameObject.SetActive(false);
                }
            }

            GameObject.Destroy(mediumCardObject);
            GameObject.Destroy(mediumCardView);
            isMediumCardDragging = false;
        }
    }
Пример #2
0
        public void saveOrder(ConfirmView confirm, int uid, int price)
        {
            var order = new order();

            order.uid      = uid;
            order.receiver = confirm.receiver;
            order.phone    = confirm.phone;
            order.address  = confirm.address;
            order.price    = price;
            order.payment  = false;
            order.shipment = false;
            db.order.AddObject(order);
            db.SaveChanges();

            var orderDetail = new orderDetail();

            foreach (var item in cartOperation.GetCurrentCart().cartItems)
            {
                orderDetail.orderId = order.id;
                orderDetail.name    = item.name;
                orderDetail.amount  = item.amount;
                orderDetail.price   = item.price;
                db.orderDetail.AddObject(orderDetail);
                db.SaveChanges(System.Data.Objects.SaveOptions.None);
            }
        }
Пример #3
0
        public ActionResult confirm(ConfirmView confirm)
        {
            if (ModelState.IsValid)
            {
                var currentCart = cartOperation.GetCurrentCart();
                int uid         = memserv.getUid(User.Identity.Name);

                pcserv.saveOrder(confirm, uid, currentCart.total);
                currentCart.clearCart();
                TempData["result"] = "購買成功";
                return(RedirectToAction("shopok", "pc"));
            }
            return(View());
        }
Пример #4
0
    void DoDecline(ConfirmView v)
    {
        GameObject.Destroy(v.gameObject);
        isDisplayingConfirm = false;
        CardLevelSheet s = cardLevelSheets[mediumCardView];

        cardLevelSheets.Remove(mediumCardView);
        foreach (CardView cv in cards)
        {
            if (cv.Id == s.ID)
            {
                cv.gameObject.SetActive(true);
            }
        }
        mapView.Clear();
    }
Пример #5
0
    void DoAccept(ConfirmView v)
    {
        GameObject.Destroy(v.gameObject);
        isDisplayingConfirm = false;
        CardLevelSheet c        = cardLevelSheets[mediumCardView];
        Point          p        = selectedTileView.Location;
        Unit           u        = new Unit(c.Name, c.ID, c.Type, c.Subtype, c.Text, c.Text, c.Text, p);
        UnitView       unitView = (UnitView)((GameObject)Instantiate(UnitPrefab)).GetComponent("UnitView");

        unitView.MouseEnter = UnitViewEnter;
        unitView.MouseExit  = UnitViewExit;
        unitView.MouseOver  = UnitViewOver;
        unitView.SetPosition(mapView.GetTileViewAt(p).GetPosition());
        unitView.SetColor(Color.white);
        unitViews[u]    = unitView;
        units[unitView] = u;

        List <string> toRemove = new List <string>();

        foreach (CardView cv in cards)
        {
            if (cv.Id == c.ID)
            {
                toRemove.Add(cv.Id);
            }
        }

        foreach (string s in toRemove)
        {
            foreach (CardView cv in cards)
            {
                if (cv.Id == s)
                {
                    cards.Remove(cv);
                    GameObject.Destroy(cv.gameObject);
                    break;
                }
            }
        }

        mapView.Clear();
        cardLevelSheets.Remove(mediumCardView);
        playerActions.Add(new SummonAction(c, u.Location));
    }
Пример #6
0
        private void InitController()
        {
            m_pop_root    = Make <GameUIComponent>("Panel_use");
            m_title_lab   = m_pop_root.Make <GameLabel>("title");
            m_content_lab = m_pop_root.Make <GameLabel>("content");
            m_ticker_lbl  = m_content_lab.Make <GameLabel>("content_ticker");
            m_one_root    = m_pop_root.Make <GameLabel>("one");
            m_one_btn     = m_one_root.Make <GameButton>("btn0");
            m_one_lab     = m_one_btn.Make <GameLabel>("Text");

            m_two_root      = m_pop_root.Make <GameLabel>("two");
            m_twoFirst_btn  = m_two_root.Make <GameButton>("btn0");
            m_twoSecond_btn = m_two_root.Make <GameButton>("btn1");
            m_twoFirst_lab  = m_twoFirst_btn.Make <GameLabel>("Text");
            m_twoSecond_lab = m_twoSecond_btn.Make <GameLabel>("Text");

            m_ori_order_in_layer = this.Canvas.sortingOrder;

            m_close_btn = this.Make <GameButton>("Button_close");

            m_confirm_root = this.Make <ConfirmView>("confirm");
        }