Exemplo n.º 1
0
        public Shop(
            IAudioEngine s,
            EventManager m,
            int No,
            int type,
            int astype,
            byte face,
            byte faceno,
            Goods[] gs,
            MapField f,
            SaveData save,
            int moneyType)
            : base(s, m, save)
        {
            this.NoTimeNext   = false;
            this.nowscene     = Shop.SCENE.fadein;
            this.moneyType    = moneyType;
            this.goods        = gs;
            this.shopType     = type;
            this.field        = f;
            this.assistant    = astype;
            this.faceSeet     = face;
            this.faceNo       = faceno;
            this.shopNo       = No;
            this.eventmanager = new EventManager(this.sound);
            this.overTop      = this.goods.Length - 5;
            if (this.overTop < 0)
            {
                this.overTop = 0;
            }
            switch (this.assistant)
            {
            case 0:
                this.massage[0] = ShanghaiEXE.Translate("Shop.Assistant1Line1");
                break;

            case 1:
                this.massage[0] = ShanghaiEXE.Translate("Shop.Assistant2Line1");
                break;

            case 2:
                this.massage[0] = ShanghaiEXE.Translate("Shop.Assistant3Line1");
                break;

            case 3:
                this.massage[0] = ShanghaiEXE.Translate("Shop.Assistant4Line1");
                break;
            }
            this.massage[1] = this.shopType != 3 ? ShanghaiEXE.Translate("Shop.AssistantLine2") : "";
            this.massage[2] = ShanghaiEXE.Translate("Shop.AssistantLine3");
        }
Exemplo n.º 2
0
        private void Control()
        {
            if (Input.IsPress(Button._A))
            {
                if (!this.help)
                {
                    if (this.savedata.ShopCount[this.shopNo, this.Select] < this.goods[this.Select].stock || this.goods[this.Select].stock == 0)
                    {
                        this.sound.PlaySE(SoundEffect.decide);
                        this.BuyEvent();
                    }
                    else if (this.shopType != 3)
                    {
                        this.sound.PlaySE(SoundEffect.error);
                        var dialogue = new Dialogue();
                        switch (this.assistant)
                        {
                        case 0:
                            dialogue = ShanghaiEXE.Translate("Shop.Assistant1OutOfStockDialogue1");
                            break;

                        case 1:
                            dialogue = ShanghaiEXE.Translate("Shop.Assistant2OutOfStockDialogue1");
                            break;

                        case 2:
                            dialogue = ShanghaiEXE.Translate("Shop.Assistant3OutOfStockDialogue1");
                            break;

                        case 3:
                            dialogue = ShanghaiEXE.Translate("Shop.Assistant4OutOfStockDialogue1");
                            break;
                        }
                        this.eventmanager.events.Clear();
                        this.eventmanager.AddEvent(new CommandMessage(this.sound, this.eventmanager, dialogue[0], dialogue[1], dialogue[2], true, this.faceSeet, this.faceNo, false, this.savedata));
                    }
                    else
                    {
                        this.sell = true;
                        this.SellEvent();
                    }
                }
                else
                {
                    this.sound.PlaySE(SoundEffect.movecursol);
                    this.help = false;
                }
            }
            else if (Input.IsPress(Button._B))
            {
                if (!this.help)
                {
                    this.sound.PlaySE(SoundEffect.cancel);
                    this.nowscene = Shop.SCENE.fadeout;
                }
                else
                {
                    this.sound.PlaySE(SoundEffect.movecursol);
                    this.help = false;
                }
            }
            else if (Input.IsPress(Button._R) && this.shopType != 3)
            {
                this.sound.PlaySE(SoundEffect.movecursol);
                if (!this.help)
                {
                    this.help = true;
                }
                else
                {
                    this.help = false;
                }
            }
            else if (this.waittime <= 0)
            {
                if (Input.IsPush(Button.Up))
                {
                    if (this.Select <= 0)
                    {
                        return;
                    }
                    if (this.cursol > 0)
                    {
                        --this.cursol;
                    }
                    else
                    {
                        --this.top;
                    }
                    this.sound.PlaySE(SoundEffect.movecursol);
                    this.waittime = Input.IsPress(Button.Up) ? 10 : 4;
                }
                else
                {
                    if (!Input.IsPush(Button.Down) || this.Select >= (this.goods.Length > 10 ? 9 : this.goods.Length - 1))
                    {
                        return;
                    }
                    if (this.cursol < 4)
                    {
                        ++this.cursol;
                    }
                    else
                    {
                        ++this.top;
                    }
                    this.sound.PlaySE(SoundEffect.movecursol);
                    this.waittime = Input.IsPress(Button.Down) ? 10 : 4;
                }
            }
            else
            {
                --this.waittime;
            }
        }
Exemplo n.º 3
0
        public override void Update()
        {
            switch (this.nowscene)
            {
            case Shop.SCENE.fadein:
                if (!this.shopmode)
                {
                    this.alpha += 51;
                    if (this.alpha >= byte.MaxValue)
                    {
                        this.alpha    = byte.MaxValue;
                        this.shopmode = true;
                        break;
                    }
                    break;
                }
                this.alpha -= 51;
                if (this.alpha <= 0)
                {
                    this.nowscene = Shop.SCENE.select;
                }
                break;

            case Shop.SCENE.select:
                if (this.eventmanager.playevent)
                {
                    this.eventmanager.UpDate();
                }
                if (!this.eventmanager.playevent)
                {
                    if (this.yesnoSelect)
                    {
                        if (this.sell)
                        {
                            this.Sell();
                        }
                        else
                        {
                            this.Buy();
                        }
                    }
                    else
                    {
                        this.Control();
                    }
                    break;
                }
                break;

            case Shop.SCENE.fadeout:
                if (this.shopmode)
                {
                    this.alpha += 51;
                    if (this.alpha >= byte.MaxValue)
                    {
                        this.alpha    = byte.MaxValue;
                        this.shopmode = false;
                        break;
                    }
                    break;
                }
                this.alpha -= 51;
                if (this.alpha <= 0)
                {
                    this.nowscene = Shop.SCENE.fadein;
                    this.cursol   = 0;
                    this.top      = 0;
                    this.EndCommand();
                }
                break;
            }
            this.FlameControl(10);
            if (!this.moveflame)
            {
                return;
            }
            ++this.cursolanime;
            if (this.cursolanime >= 3)
            {
                this.cursolanime = 0;
            }
        }