Пример #1
0
        void Update()
        {
                        #if UNITY_STANDALONE_WIN
            if (Input.GetMouseButtonDown(1))
            {
                SingleCanon _sc = singleCanonList[realCanonID];
                _sc.C_S_GunPowerUp();
            }
                        #endif

            // 如果打开按钮面板,并且超时.就自动关闭按钮面板
            if (m_bIsOpenButton && m_bTimeOut)
            {
                TweenPosition tp_LeftButton = m_gLeftButton.GetComponent <TweenPosition>();
                tp_LeftButton.from    = new Vector3(-35, 0, 0);
                tp_LeftButton.to      = new Vector3(-160, 0, 0);
                tp_LeftButton.enabled = true;
                tp_LeftButton.ResetToBeginning();

                TweenPosition tp_RightButton = m_gRightButton.GetComponent <TweenPosition>();
                tp_RightButton.from    = new Vector3(35, 0, 0);
                tp_RightButton.to      = new Vector3(160, 0, 0);
                tp_RightButton.enabled = true;
                tp_RightButton.ResetToBeginning();

                m_bIsOpenButton = false;
                m_gAllButtonBG.transform.localScale = new Vector3(1, 1, 1);
            }
        }
Пример #2
0
        // 按了结算按钮.
        public void C_S_Account_NoPanel()
        {
            AutoBuyScore_on = false;

            // 玩家自动购买炮弹数清零.
            CanonCtrl.Instance.BuyLastScore = 0;

            // 把玩家杀死的鱼,还没返还给玩家的分数马上给玩家.
            CanonCtrl.Instance.singleCanonList[CanonCtrl.Instance.realCanonID].GiveValue2PlyImmediate();

            MessageHandler.Instance.C_S_Balance();
            AudioCtrl.Instance.ShowAccount();

            // 显示结算
//			CanonCtrl.Instance.PressAccountButton ();

            // 停止锁定.
            CanonCtrl.Instance.StopLock();
            // 播放取消锁定声音.
            AudioCtrl.Instance.PressButton(false);

            // 玩家下分就不显示爆机提示.
            SingleCanon _singleCanon = CanonCtrl.Instance.singleCanonList[CanonCtrl.Instance.realCanonID];

            _singleCanon.ShowExploHint(false);
        }
Пример #3
0
        // 1 普通 npc kill.
        public static void NPC_Kill(int _canonID, int _multi, int _power, int _serverID, int _npcType)
        {
            int         _value       = _multi * _power;
            SingleCanon _singleCanon = CanonCtrl.Instance.singleCanonList[_canonID];
            SingleFish  _sf          = FishCtrl.Instance.HaveSingleFishInList(_serverID);

            // 如果这条鱼不在了,直接给分.
            if (_sf == null)
            {
                _singleCanon.AddValueList(_value, 0);
                return;
            }

            // 如果还在,那就跳到子弹击中的逻辑.
            _sf.KillByBullet(_canonID, _multi, _power, _npcType);

            // 如果是全屏炸弹,就不要显示数字,bubble, 金币柱.
            if (_sf.fishType == BaseFish.FishType.quanping)
            {
                return;
            }

            // 鱼死亡后在身上出现的数字.
            NumCtrl.Instance.CreateFishDeadNum(_value, _sf.transform.position, Quaternion.identity);

            // bubble.
            NumCtrl.Instance.AdddBubble2List(_multi, _value, _singleCanon.bubbleShowUpPos.position, Quaternion.identity, _singleCanon.upsideDown);

            // 金币柱子.
            if (TotalCylinderCtrl.Instance.showCylider)
            {
                TotalCylinderCtrl.Instance.singleCylinderList[_canonID].Add2Need2CreateList(_multi, _value, _singleCanon.cylinderShowUpPos.position);
            }

            // 给分.
            _singleCanon.AddValueList(_value, 0f);
        }
Пример #4
0
        // 玩家加入.
        public void S_C_UserJoin(int _canonID, int _plyUniqueID, uint _plyScore, int _level, string _name, int _shipColorID, int _bulletColorID, int _bulletPower, int _bulletMulti)
        {
            Vector3 _pos      = Vector3.zero;
            Vector3 _rot      = Vector3.zero;
            Vector3 _scale    = Vector3.zero;
            int     dir       = -1;
            int     _barrelID = 0;

            switch (deskType)
            {
            case 10:
                _pos = plyParameters_10[_canonID].pos;
                _rot = plyParameters_10[_canonID].rot;
                // 适配炮台大小.
                _scale    = new Vector3(plyParameters_10[_canonID].scale.x * canonScaleFitResolRatio[_canonID].x, plyParameters_10[_canonID].scale.y * canonScaleFitResolRatio[_canonID].y, 1f);
                _barrelID = plyParameters_10[_canonID].barrelID;
                break;

            case 8:
                _pos      = plyParameters_8[_canonID].pos;
                _rot      = plyParameters_8[_canonID].rot;
                _scale    = new Vector3(plyParameters_8[_canonID].scale.x * canonScaleFitResolRatio[_canonID].x, plyParameters_8[_canonID].scale.y * canonScaleFitResolRatio[_canonID].y, 1f);
                _barrelID = plyParameters_8[_canonID].barrelID;
                switch (_canonID)
                {
                case 0:
                case 1:
                case 2:
                    dir = 0;
                    dirArray[_canonID] = 0;
                    break;

                case 3:
                    dir = 1;
                    dirArray[_canonID] = 1;
                    break;

                case 4:
                case 5:
                case 6:
                    dir = 2;
                    dirArray[_canonID] = 2;
                    break;

                case 7:
                    dir = 3;
                    dirArray[_canonID] = 3;
                    break;
                }
                break;

            case 6:
                _pos = plyParameters_6[_canonID].pos;
                _rot = plyParameters_6[_canonID].rot;
                //_scale = new Vector3(plyParameters_6[_canonID].scale.x * canonScaleFitResolRatio[_canonID].x, plyParameters_6[_canonID].scale.y * canonScaleFitResolRatio[_canonID].y, 1f);
                _barrelID = plyParameters_6[_canonID].barrelID;
                switch (_canonID)
                {
                case 0:
                case 1:
                case 2:
                    dir = 0;
                    break;

                case 3:
                case 4:
                case 5:
                    dir = 2;
                    break;
                }
                break;

            case 4:
                _pos      = plyParameters_4[_canonID].pos;
                _rot      = plyParameters_4[_canonID].rot;
                _scale    = new Vector3(plyParameters_4[_canonID].scale.x * canonScaleFitResolRatio[_canonID].x, plyParameters_4[_canonID].scale.y * canonScaleFitResolRatio[_canonID].y, 1f);
                _barrelID = plyParameters_4[_canonID].barrelID;
                switch (_canonID)
                {
                case 0:
                case 1:
                    dir = 0;
                    break;

                case 2:
                case 3:
                    dir = 2;
                    break;
                }
                break;

            case 2:
                _pos      = plyParameters_2[_canonID].pos;
                _rot      = plyParameters_2[_canonID].rot;
                _scale    = new Vector3(plyParameters_2[_canonID].scale.x * canonScaleFitResolRatio[_canonID].x, plyParameters_2[_canonID].scale.y * canonScaleFitResolRatio[_canonID].y, 1f);
                _barrelID = plyParameters_2[_canonID].barrelID;
                switch (_canonID)
                {
                case 0:
                case 1:
                    dir = 0;
                    break;
                }
                break;

            case 1:
                _pos      = plyParameters_1[_canonID].pos;
                _rot      = plyParameters_1[_canonID].rot;
                _scale    = new Vector3(plyParameters_1[_canonID].scale.x * canonScaleFitResolRatio[_canonID].x, plyParameters_1[_canonID].scale.y * canonScaleFitResolRatio[_canonID].y, 1f);
                _barrelID = plyParameters_1[_canonID].barrelID;
                switch (_canonID)
                {
                case 0:
                    dir = 0;
                    break;
                }
                break;

            default:
                Debug.Log(" deskType = " + deskType + " / deskType = " + deskType + " / _pos = " + _pos + " / _rot = " + _rot + " / _scale " + _scale);
                return;
            }

            // 创建炮台.
//			Transform _temp = Factory.Create(canon_Barrel[_canonID].canonPrefab, Vector3.zero, Quaternion.identity);
            // 实现任意玩家的炮台都处于屏幕下方
            if (plyParameters_6[realCanonID].barrelID == 2)
            {
                turn_screen = true;
            }
            else
            {
                turn_screen = false;
            }
            if (turn_screen == true && turn_screen_on_of)
            {
                if (plyParameters_6[_canonID].barrelID == 2)
                {
                    _pos      = plyParameters_6[_canonID - 3].pos;
                    _rot      = plyParameters_6[_canonID - 3].rot;
                    _scale    = new Vector3(plyParameters_6[_canonID - 3].scale.x * canonScaleFitResolRatio[_canonID - 3].x, plyParameters_6[_canonID - 3].scale.y * canonScaleFitResolRatio[_canonID - 3].y, 1f);
                    _barrelID = 0;
                }
                else
                {
                    _pos      = plyParameters_6[_canonID + 3].pos;
                    _rot      = plyParameters_6[_canonID + 3].rot;
                    _scale    = new Vector3(plyParameters_6[_canonID + 3].scale.x * canonScaleFitResolRatio[_canonID + 3].x, plyParameters_6[_canonID + 3].scale.y * canonScaleFitResolRatio[_canonID + 3].y, 1f);
                    _barrelID = 2;
                }
                GameObject camera = GameObject.Find("Camera");
                camera.GetComponent <Transform>().rotation = new Quaternion(0.0f, 0.0f, 1.0f, 0.0f);
                GameObject lockCamera = GameObject.Find("LockCtrl");
                lockCamera.GetComponent <Transform>().rotation = new Quaternion(0.0f, 0.0f, 1.0f, 0.0f);

                // 跑马灯的旋转	开启
                Fishing.Instance.MarqueeReverse = true;
            }
            else
            {
                if (plyParameters_6[_canonID].barrelID == 2)
                {
                    _barrelID = 2;
                }
                else
                {
                    _barrelID = 0;
                }
                _pos   = plyParameters_6[_canonID].pos;
                _rot   = plyParameters_6[_canonID].rot;
                _scale = new Vector3(plyParameters_6[_canonID].scale.x * canonScaleFitResolRatio[_canonID].x, plyParameters_6[_canonID].scale.y * canonScaleFitResolRatio[_canonID].y, 1f);

                // 跑马灯的旋转	关闭
                Fishing.Instance.MarqueeReverse = false;
            }

            // 玩家进入,回收该位置炮台,并且singleCanonList列表设置为空
            SingleCanon[] sc_temp = canonCache.GetComponentsInChildren <SingleCanon>();
            // 遍历canonCache下的所有炮台,如果有炮台的位置和即将生成的炮台的位置重叠,则删除原有的炮台
            foreach (SingleCanon var in sc_temp)
            {
                if (_pos == var.transform.localPosition)
                {
                    Destroy(var.gameObject);
                }
            }
            singleCanonList[_canonID] = null;

            Transform _temp = Factory.Create(canon_Barrel[_barrelID].canonPrefab, Vector3.zero, Quaternion.identity);

            _temp.parent           = canonCache;
            _temp.localPosition    = _pos;
            _temp.localEulerAngles = _rot;
//			_temp.localScale = _scale;
            _temp.localScale = Vector3.one;

            Debug.Log("Init canon:" + _pos + " " + _scale + " parent:" + canonCache.localScale + " " + canonCache.localPosition);

            // 初始化炮台参数.
            SingleCanon _sc = _temp.gameObject.GetComponent <SingleCanon>();

            singleCanonList[_canonID] = _sc;
            _sc.canonID = _canonID;
            _sc.m_sCanonNumSprite.spriteName = "CanonNum_" + (_canonID + 1).ToString();
            _sc.InitCanonParam(_canonID, _plyUniqueID, transform, fireGap, _plyScore, _bulletMulti, _bulletPower, _level, _name, dir, _shipColorID, _bulletColorID, allowAllPlyFire);

            // 真实的玩家才显示 player name.
            if (_canonID == realCanonID)
            {
                // 显示名字.
                SetPlyName(_name);
                // 显示金币数.
                SetGoldValue(goldValue);
                // 创建锁定线.
                LockCtrl.Instance.CreateLockLine(_canonID);

                // 对炮台预设的标识赋值,便于计时调用
                playerLogo = _temp.FindChild("Switch2").gameObject;

                //	把真实玩家的图层调高,盖过蒙版.2s后改回正常值.
                //changeDepth_hight();

                // 开场黑屏效果
                if (_temp.FindChild("Switch").gameObject != null)
                {
                    _temp.FindChild("Switch").gameObject.SetActive(true);
                }
                else
                {
                    return;
                }
            }

            // 创建金币柱控制器.
            Vector3 showUpPos  = _sc.cylinderShowUpPos.position;
            Vector3 _targetPos = _sc.cylinderTargetPos.position;

            TotalCylinderCtrl.Instance.CreateCylinderCtrl4OnePly(_canonID, showUpPos, _targetPos);

            // 播放玩家加入的声音.
            AudioCtrl.Instance.UserIn();
        }
Пример #5
0
        // 2-2. 接收到缓存的分.
        public static void NPC_Kill_GiveCacheFromList(int _canonID, int _multi, int _value)
        {
            SingleCanon _singleCanon = CanonCtrl.Instance.singleCanonList[_canonID];

            int _cacheIndexInList = -1;

            for (int i = 0; i < cacheFish.Count; i++)
            {
                if (cacheFish[i].value == _value)
                {
                    _cacheIndexInList = i;

                    // 如果是黑洞,那么退出,因为在上面 NPC_Kill_AddCacheInList 中就已经跳进 KillByBullet 中慢慢吸鱼给分了.
                    if (cacheFish[i].sf.fishType == BaseFish.FishType.blackHall)
                    {
                        if (cacheFish.Contains(cacheFish[_cacheIndexInList]))
                        {
                            cacheFish.Remove(cacheFish[_cacheIndexInList]);
                        }
                        return;
                    }
                    break;
                }
            }

            // 如果在上面的缓存击杀的 list 中没有找到记录的这个分数.
            if (_cacheIndexInList == -1)
            {
                // 直接加分.
                _singleCanon.AddValueList(_value, 0f);
                cacheFish.Remove(cacheFish[_cacheIndexInList]);
                return;
            }

            // 如果这条鱼不在了.
            if (cacheFish[_cacheIndexInList].sf == null)
            {
                // 直接加分.
                _singleCanon.AddValueList(_value, 0f);
                cacheFish.Remove(cacheFish[_cacheIndexInList]);
                return;
            }

            // 加分.
            _singleCanon.AddValueList(_value, 0f);

            // 鱼死亡后在身上出现的数字.
            NumCtrl.Instance.CreateFishDeadNum(_value, cacheFish[_cacheIndexInList].pos, Quaternion.identity);

            // bubble.
            NumCtrl.Instance.AdddBubble2List(_multi, _value, _singleCanon.bubbleShowUpPos.position, Quaternion.identity, _singleCanon.upsideDown);

            // 金币柱子.
            if (TotalCylinderCtrl.Instance.showCylider)
            {
                TotalCylinderCtrl.Instance.singleCylinderList[_canonID].Add2Need2CreateList(_multi, _value, _singleCanon.cylinderShowUpPos.position);
            }

            // 从 list 中移除这个缓存击杀.
            cacheFish.Remove(cacheFish[_cacheIndexInList]);
        }