Esempio n. 1
0
        private void _openChestCallBack()
        {
            if (_chest.ObjType == 26)
            {
                if (player != null)
                {
                    LotteryChange change = new LotteryChange();
                    change.stratPos = _chest.GetChestOpenPositon();
                    change.nDelta   = _nChestLottery;
                    _level.raiseLotteryChangeEvent(hookPos, player.Lottery, change);
                }

                Utils.PlaySound(AudioNames.GotReward);

                _chest.ChestDisappear(() =>
                {
                    _bChest          = false;
                    ResFishInfo info = InfoManager.Instance.GetFishInfo(_chest.ObjType);
                    _level.fishPoolMgr.Recycle(info.name, _chest);
                });
            }
            else if (_chest.ObjType == 27)
            {
                Action callBack = _wheelCallBack;
                UIManager.Instance.ShowWindow <WheelWindow>("WheelWindow", ArgList.Create(_vec3ChestPos, _nChestLottery, 0, 0, callBack), false);
            }
        }
Esempio n. 2
0
        public override void ClearLastHookThenIdle()
        {
            base.ClearLastHookThenIdle();
            foreach (var item in _hookedFishes)
            {
                if (item.Value.ObjType == 26 || item.Value.ObjType == 27)
                {
                    _chest  = (ChestFish)item.Value;
                    _bChest = true;
                }
                else
                {
                    ResFishInfo info = InfoManager.Instance.GetFishInfo(item.Value.ObjType);
                    _level.fishPoolMgr.Recycle(info.name, item.Value);
                }
            }
            _hookedFishes.Clear();

            if (_bChest)
            {
                _chest.FishRenderer.enabled = false;
                _chest.OpenChest(_vec3ChestPos, _openChestCallBack);
            }

            _raiseIdleAgainEvent();
        }
Esempio n. 3
0
 public void UpDate()
 {
     this._timeOver.Clear();
     foreach (var item in _fishes)
     {
         item.Value.OnUpDate();
         if (item.Value.TimeOver())
         {
             this._timeOver.Add(item.Key);
         }
     }
     foreach (var key in this._timeOver)
     {
         IFish       fish = this._fishes[key];
         ResFishInfo info = InfoManager.Instance.GetFishInfo(fish.ObjType);
         level.fishPoolMgr.Recycle(info.name, fish);
         this._fishes.Remove(key);
     }
     _escapeTimeOver.Clear();
     foreach (var fish in _fishesEscaped)
     {
         fish.OnEscapeUpDate();
         if (fish.EscapeTimeOver())
         {
             this._escapeTimeOver.Add(fish);
         }
     }
     foreach (var fish in this._escapeTimeOver)
     {
         ResFishInfo info = InfoManager.Instance.GetFishInfo(fish.ObjType);
         level.fishPoolMgr.Recycle(info.name, fish);
         this._fishesEscaped.Remove(fish);
     }
 }
Esempio n. 4
0
        public void Remove(int id)
        {
            IFish       fish = this._fishes[id];
            ResFishInfo info = InfoManager.Instance.GetFishInfo(fish.ObjType);

            level.fishPoolMgr.Recycle(info.name, fish);
            this._fishes.Remove(id);
        }
Esempio n. 5
0
 public void ClearAllActiveFish()
 {
     foreach (var item in _fishes)
     {
         IFish       fish = item.Value;
         ResFishInfo info = InfoManager.Instance.GetFishInfo(fish.ObjType);
         level.fishPoolMgr.Recycle(info.name, fish);
     }
     _fishes.Clear();
 }
Esempio n. 6
0
        public IFish Spawn(int iType)
        {
            ResFishInfo info = InfoManager.Instance.GetFishInfo(iType);

            if (info == null)
            {
                DebugLogger.LogWarning(eLogType.LT_LOGIC, "no fish type: " + iType.ToString());
                return(null);
            }
            if (this._pools.ContainsKey(info.name))
            {
                return(this._pools[info.name].Get());
            }
            return(null);
        }
Esempio n. 7
0
        public void _wheelCallBack()
        {
            if (player != null)
            {
                LotteryChange change = new LotteryChange();
                change.stratPos = Vector3.back;
                change.nDelta   = _nChestLottery;
                _level.raiseLotteryChangeEvent(hookPos, player.Lottery, change);
            }

            Utils.PlaySound(AudioNames.GotReward);

            _bChest = false;
            ResFishInfo info = InfoManager.Instance.GetFishInfo(_chest.ObjType);

            _level.fishPoolMgr.Recycle(info.name, _chest);
        }
Esempio n. 8
0
        public static IFish Creator(int iType)
        {
            IFish       fish    = null;
            GameObject  objfish = null;
            ResFishInfo info    = InfoManager.Instance.GetFishInfo(iType);
            FishType    bh_type = (FishType)Enum.Parse(typeof(FishType), info.bh_type);

            switch (bh_type)
            {
            case FishType.NORMAL_FISH:
                objfish = ResourceMgr.Instance.CreateObj(info.name, SceneMgr.Instance.fishes);
                if (objfish != null)
                {
                    fish = objfish.AddComponent <NormalFish>();
                    //Add by Xhj. Initiate fish when it is created.
                    fish.OnCreated(info.size, info.score);
                }
                break;

            case FishType.CHEST_FISH:
                objfish = ResourceMgr.Instance.CreateObj(info.name, SceneMgr.Instance.fishes);
                if (objfish != null)
                {
                    fish = objfish.AddComponent <ChestFish>();
                    //Add by Xhj. Initiate fish when it is created.
                    fish.OnCreated(info.size, info.score);
                }
                break;

            default:
                break;
            }
            if (fish != null)
            {
                fish.ObjType = iType;
            }
            return(fish);
        }
Esempio n. 9
0
 public override void ClearLastHookThenIdle()
 {
     base.ClearLastHookThenIdle();
     foreach (var item in _hookedFishes)
     {
         if (item.Value.ObjType == 27)
         {
             _level.raiseDrawingLotteryEvent(hookPos, postion =>
             {
                 if (player != null)
                 {
                     LotteryChange change = new LotteryChange();
                     change.stratPos      = postion;
                     change.nDelta        = _nChestLottery;
                     _level.raiseLotteryChangeEvent(hookPos, player.Lottery, change);
                 }
                 Utils.PlaySound(AudioNames.GotReward);
             });
         }
         ResFishInfo info = InfoManager.Instance.GetFishInfo(item.Value.ObjType);
         _level.fishPoolMgr.Recycle(info.name, item.Value);
     }
     _hookedFishes.Clear();
 }