Exemple #1
0
 protected override void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (disposing)
         {
             InDrive          = null;
             ThrowActionPoint = null;
             if (CommonFunction.IsNull(Options) == false)
             {
                 foreach (BaseOption o in Options)
                 {
                     o.Dispose();
                 }
                 Options.Clear();
                 Options = null;
             }
         }
     }
     base.Dispose(disposing);
 }
Exemple #2
0
    public static BagBase GetItem(long objNo)
    {
        TableBagData data = Array.Find(Table, i => i.ObjNo == objNo);
        BagBase      item = new BagBase();

        item.Initialize();
        item.MaxGap = (sbyte)CommonFunction.ConvergenceRandom(data.StartGap, data.Startprob, data.Con, data.MaxGap);
        item.ObjNo  = data.ObjNo;
        if (GameStateInformation.IsEnglish == false)
        {
            item.DisplayName = data.DisplayName;
            item.Description = data.Description;
        }
        else
        {
            item.DisplayName = data.DisplayNameEn;
            item.Description = data.DescriptionEn;
        }
        item.ThrowDexterity    = data.ThrowDexterity;
        item.IsDisplayContents = data.IsDisplayContents;
        item.BgType            = data.Bgtype;
        return(item);
    }
Exemple #3
0
        private void InitializeItemMenu(bool issort = false)
        {
            CommonFunction.SetActive(_itemMenu, true);

            switch (KeyControlInformation.Info.OpMode)
            {
            case OperationMode.KeyOnly:
                CommonFunction.SetActive(_UIBase, false);

                break;

            case OperationMode.UseMouse:
                CommonFunction.SetActive(_UIBase, true);

                break;
            }

            List <BaseItem> list = new List <BaseItem>();

            //ItemTypeをベースにタブ項目を作る
            Dictionary <int, string> names = new Dictionary <int, string>();

            foreach (ItemType val in CommonFunction.EnumItemTypes)
            {
                //メンバ名を取得する
                string eName = Enum.GetName(typeof(ItemType), val);
                names.Add((int)val, eName);
            }
            InitializeTabs(names);

            //Allならすべて、そうでなければ対象だけ
            if (nowType == (int)ItemType.All)
            {
                foreach (BaseItem i in TempItems)
                {
                    //ソートがオンなら
                    if (issort == true)
                    {
                        i.SortNo = i.ObjNo;
                    }

                    //格納オブジェクトの場合
                    if (i.IsDrive == true)
                    {
                    }
                    else
                    {
                        list.Add(i);
                    }
                }

                //ソート
                list = list.OrderBy(i => i.SortNo).ToList();
            }
            else
            {
                foreach (BaseItem i in TempItems)
                {
                    if ((int)i.IType != nowType)
                    {
                        continue;
                    }
                    //ソートがオンなら
                    if (issort == true)
                    {
                        i.SortNo = i.ObjNo;
                    }
                    //格納オブジェクトの場合
                    if (i.IsDrive == true)
                    {
                        //格納元が表示許可を出しているか調査
                        BagBase temp = i.InDrive;
                        if (temp.IsDisplayContents == true)
                        {
                            list.Add(i);
                        }
                    }
                    else
                    {
                        list.Add(i);
                    }
                }


                list = list.OrderBy(i => i.SortNo).ToList();
            }

            //アイテムリストを作成する
            InitializeItems(list);

            //タブの設定
            SetTabSelect(nowType);

            //ステータス情報の初期化
            InitializeStatus();
        }
    /// <summary>
    /// アイテムを入れる
    /// </summary>
    public BaseItem PutinItem(int itype, BaseItem target, PlayerCharacter player)
    {
        //サウンドを鳴らす
        SoundInformation.Sound.Play(SoundInformation.SoundType.Putin);

        DisplayInformation.Info.AddMessage(string.Format(CommonConst.Message.PutinAction, target.DisplayNameInMessage, this.DisplayNameInMessage));

        switch (BgType)
        {
        //保存
        case BagType.Save:

            BagItems.Add(target);
            target.InDrive = this;
            return(target);

            break;

        //Recycle
        case BagType.Recycle:

            //ターゲットが別のバッグに入っていたら取り出しておく
            if (target.IsDrive == true)
            {
                BagBase bag = target.InDrive;
                bag.PutoutItem(target);
            }

            OtherBase d = TableOther.GetItem(CommonConst.ObjNo.Dollar);
            d.Initialize();
            d.SellingPrice = target.SellingPrice;

            player.RecoverHp(999);
            EffectDamage dm = EffectDamage.CreateObject(player);
            dm.SetText("999", AttackState.Heal);
            dm.Play();
            SoundInformation.Sound.Play(SoundInformation.SoundType.Recover);

            BagItems.Add(d);
            d.InDrive = this;

            return(d);

            break;

        //変化
        case BagType.Change:
            //ターゲットが別のバッグに入っていたら取り出しておく
            if (target.IsDrive == true)
            {
                BagBase bag = target.InDrive;
                bag.PutoutItem(target);
            }
            //uintの乱数を取得
            uint     rand = CommonFunction.GetRandomUInt32();
            BaseItem ch   = TableItemIncidence.GetItem(itype, rand, true);
            if (CommonFunction.IsNull(ch) == true)
            {
                return(null);
            }
            int stopper = 0;
            while (ch.IType == ItemType.Bag || ch.IType == ItemType.Material)
            {
                if (stopper > 30)
                {
                    return(null);
                }
                stopper++;
                rand = CommonFunction.GetRandomUInt32();
                ch   = TableItemIncidence.GetItem(itype, rand, true);
            }

            ch.IsAnalyse = DungeonInformation.Info.IsAnalyze == false;
            BagItems.Add(ch);
            ch.InDrive = this;

            //PlayerCharacter.RemoveItem(target);
            //player.AddItem(ch, DateTime.Now.Ticks);

            return(ch);

            break;

        //コロッケ
        case BagType.Food:
            //ターゲットが別のバッグに入っていたら取り出しておく
            if (target.IsDrive == true)
            {
                BagBase bag = target.InDrive;
                bag.PutoutItem(target);
            }
            BaseItem tar = TableItemIncidence.GetTypeItemRandom(itype, ItemType.Food, true);
            if (CommonFunction.IsNull(tar) == true)
            {
                return(null);
            }
            BagItems.Add(tar);
            tar.InDrive = this;

            //PlayerCharacter.RemoveItem(target);
            //player.AddItem(tar, DateTime.Now.Ticks);

            return(tar);

            break;

        //普通
        case BagType.Normal:

            BagItems.Add(target);
            target.InDrive = this;
            return(target);

            break;
        }

        return(target);
    }