Example #1
0
        public static float GetMyPlayerPower()
        {
            //var info = GameGOW.Get().MyPlayer.m_pInfo;
            var info = GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo;

            return(info.m_iBombSpeed * 1.0f / info.m_pInstructionData.fire_range);
        }
Example #2
0
 public static void InputAngle(int type)
 {
     if (GameGOW.Get().BattleMgr.m_bIsInBattle == false)
     {
         return;
     }
     if (Network.gamemode == BattleType.AI_1v1)
     {
         int index = GameGOW.Get().BattleMgr.m_iCurrentRoundPlayerIndex;
         int id    = GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[index].m_iPlayerUID;
         if (Network.playerid == id)
         {
             var m_pCharacterLogic = GameGOW.Get().BattleMgr.m_pCurrentPlayer;
             m_pCharacterLogic.OnAttackAngleChange(type);
         }
     }
     else if (Network.NetworkMode == true)
     {
         int index = GameGOW.Get().BattleMgr.m_iCurrentRoundPlayerIndex;
         int id    = GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[index].m_iPlayerUID;
         if (Network.playerid == id)
         {
             var m_pCharacterLogic = GameGOW.Get().BattleMgr.m_pCurrentPlayer;
             m_pCharacterLogic.OnAttackAngleChange(type);
         }
     }
     else
     {
         var m_pCharacterLogic = GameGOW.Get().BattleMgr.m_pCurrentPlayer;
         m_pCharacterLogic.OnAttackAngleChange(type);
     }
 }
Example #3
0
        public void SetData(MapData pData)
        {
            m_pCamera.xMargin      = pData.camera_margin_x;
            m_pCamera.yMargin      = pData.camera_margin_y;
            m_pCamera.xSmooth      = pData.camera_smooth_x;
            m_pCamera.ySmooth      = pData.camera_smooth_y;
            m_pCamera.minXAndY     = new Vector2(pData.camera_min_x, pData.camera_min_y);
            m_pCamera.maxXAndY     = new Vector2(pData.camera_max_x, pData.camera_max_y);
            m_pCamera.BgWidth      = pData.m_listBG[0].Width;
            m_pCamera.TerrainWidth = pData.m_listTerrain[0].Width;
            ResourceManager mgr = GameGOW.Get().ResourceMgr;

            for (int i = 0; i < pData.m_listBG.Count; ++i)
            {
                MapCellData    cellData = pData.m_listBG[i];
                GameObject     obj      = mgr.GetRes("Prefab/MapCell");
                SpriteRenderer spr      = obj.GetComponent <SpriteRenderer>();
                Texture2D      texture  = mgr.GetRes <Texture2D>(cellData.resource);
                //因为背景图很大,需要压缩,而压缩后长宽会改变,所以需要Bilinear将长宽设置回原图的值,又因为压缩格式的图片不能重新设置尺寸,所以需要重新创建一张图
                //创建一张图片
                var newTexture = new Texture2D(texture.width, texture.height);
                //设置像素
                newTexture.SetPixels(texture.GetPixels());
                //应用更改
                newTexture.Apply();
                //设置图片尺寸
                TextureScale.Bilinear(newTexture, cellData.Width, cellData.Height);
                //创建Sprite
                Rect   rect = new Rect(0, 0, newTexture.width, newTexture.height);
                Sprite sp   = Sprite.Create(newTexture, rect, new Vector2(0, 0));
                spr.sprite                  = sp;
                obj.transform.parent        = m_pBackGroundLayer;
                obj.transform.localPosition = new Vector3(cellData.pos_x, cellData.pos_y, m_pBackGroundLayer.position.z - i * 0.01f);
            }
        }
Example #4
0
 public static void Send_Skip()
 {
     if (Network.gamemode == BattleType.AI_1v1)
     {
         if (Network.Attacking == 0)
         {
             if (GameGOW.Get().BattleMgr.m_pCurrentPlayer.ID == Network.playerid)
             {
                 EventDispatcher.DispatchEvent("EventHideBattleJoyStickUI", null, null);
             }
             else
             {
                 EventDispatcher.DispatchEvent("EventShowBattleJoyStickUI", null, null);
             }
             GameGOW.Get().BattleMgr.ChangeController_Quick();
             if (GameGOW.Get().BattleMgr.Get_InBattle() == true && GameGOW.Get().BattleMgr.m_iCurrentRoundPlayerIndex % 2 == 1)
             {
                 GameGOW.Get().AIMgr.Act_AI_1v1();
             }
         }
     }
     else if (Network.NetworkMode == true)
     {
         Network.Send_SKIP();
     }
     else
     {
         GameGOW.Get().BattleMgr.ChangeController();
     }
 }
Example #5
0
 public void PlaySound(int temp, string name)
 {
     if (temp == 1)
     {
         EfxSource.clip = GameGOW.Get().ResourceMgr.GetRes <AudioClip>(name);
         EfxSource.Play();
     }
     else if (temp == 0)
     {
         if (name == "music")
         {
             MusicSource.Stop();
         }
         else
         {
             EfxSource.Stop();
         }
     }
     else if (temp == -1)
     {
         MusicSource.Stop();
         MusicSource.clip = GameGOW.Get().ResourceMgr.GetRes <AudioClip>(name);
         MusicSource.Play();
     }
     else if (temp == 2)
     {
         SpeakSource.clip = GameGOW.Get().ResourceMgr.GetRes <AudioClip>(name);
         SpeakSource.Play();
     }
     else if (temp == 3)
     {
         ElseSource.clip = GameGOW.Get().ResourceMgr.GetRes <AudioClip>(name);
         ElseSource.Play();
     }
 }
Example #6
0
 public static void InputFunctionUp(int type)
 {
     if (GameGOW.Get().BattleMgr.m_bIsInBattle == false)
     {
         return;
     }
     if (Network.gamemode == BattleType.AI_1v1)
     {
         int index = GameGOW.Get().BattleMgr.m_iCurrentRoundPlayerIndex;
         int id    = GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[index].m_iPlayerUID;
         if (Network.playerid == id && Network.Attacking == 1)
         {
             Network.Attacking = 2;
             var m_pCharacterLogic = GameGOW.Get().BattleMgr.m_pCurrentPlayer;
             m_pCharacterLogic.OnFunctionKeyUp(type);
         }
     }
     else if (Network.NetworkMode == true)
     {
         int index = GameGOW.Get().BattleMgr.m_iCurrentRoundPlayerIndex;
         int id    = GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[index].m_iPlayerUID;
         if (Network.playerid == id && Network.Attacking == 1)
         {
             Network.Attacking = 2;
             var m_pCharacterLogic = GameGOW.Get().BattleMgr.m_pCurrentPlayer;
             m_pCharacterLogic.OnFunctionKeyUp(type);
             Network.Send_Attach(false);
         }
     }
     else
     {
         var m_pCharacterLogic = GameGOW.Get().BattleMgr.m_pCurrentPlayer;
         m_pCharacterLogic.OnFunctionKeyUp(type);
     }
 }
Example #7
0
        public static float GetMyPlayerEnergy()
        {
            //var info = GameGOW.Get().MyPlayer.m_pInfo;
            var info = GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo;

            return(info.m_iMoveEnergy * 1.0f / info.m_iMaxMoveEnergy);
        }
Example #8
0
 public static void SetAni(int id, GameObject anitest)
 {
     anitest.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
     anitest            = GameGOW.Get().ResourceMgr.GetRes("Spine/TK100001");
     test               = anitest.GetComponent <SkeletonAnimation>();
     test.loop          = true;
     test.AnimationName = "IDLE1";
 }
Example #9
0
        void Start()
        {
            // Debug.Log("AAAAAAAAAAAAA   ");

            prevScale = particleScale;
            GameGOW.Get().OnWindPlay += Control_Wind;
            gameObject.SetActive(false);
        }
Example #10
0
        private void ShowMessage(int id)
        {
            string path = GameGOW.Get().DataMgr.GetChatByID(id).chat_text;

            Message.GetComponent <TextMesh>().text = path;
            MessageBg.gameObject.SetActive(true);
            _messageCd = 2f;
        }
Example #11
0
 public static int SetMatchTime(int time)
 {
     if (time >= 0)
     {
         GameGOW.Get().match_time = time;
     }
     return(GameGOW.Get().match_time);
 }
Example #12
0
 // Use this for initialization
 void Start()
 {
     GameGOW.Get().CharacterMgr.OnCharacterNew += AddCharacter;
     GameGOW.Get().CharacterMgr.OnCharacterDelete += DeleteCharacter;
     GameGOW.Get().BombMgr.OnBombNew += AddBomb;
     GameGOW.Get().BombMgr.OnBombDelete += DeleteBomb;
     GameGOW.Get().MapMgr.OnTerrainCellNew += AddTerrainCell;
     AddEvents();
 }
Example #13
0
        public void AddCharacter(CharacterLogic logic)
        {
            GameObject         obj  = GameGOW.Get().ResourceMgr.GetRes("Prefab/CharacterLogic");
            CharacterLogicView view = obj.GetComponent <CharacterLogicView>();

            view.SetCharacterLogic(logic);
            obj.transform.parent         = m_pZSort;
            m_dicCharacterView[logic.ID] = view;
        }
Example #14
0
        public static float GetMyPlayerWait()
        {
            var info = GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo;

            return(info.m_iHP * 1.0f / info.m_iMaxHP);
            //return info.MoveEnergy * 100.0f / info.m_iMaxMoveEnergy;
            //var time = GameGOW.Get().BattleMgr.m_iCurrentRoundTime;
            //return time * 1.0f / BattleManager.ROUND_TIME;
        }
Example #15
0
 public void Init()
 {
     SpeakSource.volume = 0.65f;
     MusicSource.volume = 0.5f;  //背景音乐音量
     EfxSource.volume   = 0.55f; //音效音量
     ElseSource.volume  = 0.55f;
     MusicSource.clip   = GameGOW.Get().ResourceMgr.GetRes <AudioClip>("sound/Music/battlebg_4");
     MusicSource.Play();
 }
Example #16
0
        public static int GetSetEnergy(int energy)
        {
            var info = GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo;

            if (energy > 0)
            {
                info.m_iMoveEnergy = energy;
            }
            return(info.m_iMoveEnergy);
        }
Example #17
0
        public static void Show_Message(int id)
        {
            var info = GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo;

            if (Network.NetworkMode == true)
            {
                info = GameGOW.Get().CharacterMgr.GetCharacterByUid(Network.playerid).m_pInfo;
            }
            info.MessageID = id + 2000;
        }
Example #18
0
        public static float GetAngle()
        {
            var   m_pCharacterLogic = GameGOW.Get().BattleMgr.m_pCurrentPlayer;
            float angle             = m_pCharacterLogic.GetFireAngle() + m_pCharacterLogic.CalcObjectAngle();

            if (m_pCharacterLogic.m_pInfo.m_iFacing == GameDefine.FACING_LEFT)
            {
                angle *= -1;
            }
            return(angle);           // Math.Abs(angle);
        }
Example #19
0
        public void AddTerrainCell(Texture2D texture, MapCellData pData)
        {
            GameObject     obj  = GameGOW.Get().ResourceMgr.GetRes("Prefab/MapCell");
            SpriteRenderer spr  = obj.GetComponent <SpriteRenderer>();
            Rect           rect = new Rect(0, 0, texture.width, texture.height);
            Sprite         sp   = Sprite.Create(texture, rect, new Vector2(0, 0));

            spr.sprite                  = sp;
            obj.transform.parent        = m_pTerrainLayer;
            obj.transform.localPosition = new Vector3(pData.pos_x, pData.pos_y, m_pBackGroundLayer.position.z - m_pTerrainLayer.childCount * 0.01f);
        }
Example #20
0
        private void ShowEmoji(int id)
        {
            string path = GameGOW.Get().DataMgr.GetImageByID(id).image_source;

            Emoji.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(path);
            Emoji.gameObject.SetActive(true);
            if (_emojiScaleTweener != null)
            {
                _emojiScaleTweener.Restart(false);
            }
            _emojiCd = 2f;
        }
Example #21
0
 public static void Send_Quit_Button()
 {
     //GameGOW.Get().BattleMgr.StopBattle();
     GameGOW.Get().BattleMgr.m_bIsInBattle = false;
     if (Network.gamemode == BattleType.AI_1v1)
     {
     }
     else if (Network.NetworkMode == true)
     {
         Network.Send_Quit();
     }
 }
Example #22
0
    protected virtual void gui()
    {
        GameGOW compoment = (GameGOW)target;

        EditorGUI.BeginChangeCheck();

        EditorGUILayout.Space();

        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
        }
    }
Example #23
0
        public static string GetSkillInfo(string type, int id)
        {
            if (type == "NAME")
            {
                return(GameGOW.Get().DataMgr.GetSkillINstructionDataByID(id).default_name);
            }
            if (type == "DESCRIPTION")
            {
                return(GameGOW.Get().DataMgr.GetSkillINstructionDataByID(id).description);
            }

            return("???");
        }
Example #24
0
        public static float GetSkillInfo2(string type, int id)
        {
            if (id == 100)
            {
                id = 0;
            }
            if (type == "ENERGY")
            {
                return(GameGOW.Get().DataMgr.GetSkillINstructionDataByID(id).energy);
            }

            return(0.0f);
        }
Example #25
0
        private void OnBattleStart(object sender, EventArgs e)
        {
            LuaFramework.Util.SendMessageToLua("EventBattleStart");
            ChangeControllerEvent chgEvent = e as ChangeControllerEvent;

            if (chgEvent != null && m_dicCharacterView.ContainsKey(chgEvent.m_iUniqueID))
            {
                CharacterLogicView view = m_dicCharacterView[chgEvent.m_iUniqueID];
                m_pCamera.SetFocus(view.transform);
            }
            GameGOW.Get().PlayWind(1, 0.0f, true);
            GameGOW.Get().MapMgr.Wind = 0;
            //BackgroundParallax.Get().SetCamera();
        }
Example #26
0
 public static string GetCharacterName(string ans)
 {
     if (ans == "wechat")
     {
         if (SdkManager.wxLogin == true)
         {
             return(SdkManager.wxName);
         }
         else
         {
             return(null);
         }
     }
     return(GameGOW.Get().DataMgr.GetCharaterName(ans));
 }
Example #27
0
    public void Update()
    {
        ScanMSGs();

        if (state == NetworkState.Disconnected)
        {
            //MessageBox.Instance.Show("已经断开连接,请刷新页面重新链接!", OnDisconnect);
#if xue
            if (NetworkConfig.Click_Exit_Button == true)
            {
                NetworkConfig.Click_Exit_Button = false;
            }
            else
            {
                GameGOW.Get().BattleMgr.m_bIsInBattle = false;
                EventDispatcher.DispatchEvent("EventShowMessageUI", null, null);
            }
#endif
            state = NetworkState.None;
        }

        if (client != null && client.Connected)
        {
            if (Time.realtimeSinceStartup - lastBeatSendTime >= heartBeatInterval)
            {
                //Network.Send_Heart();  //发送心跳包
            }

            if (lastBeatRecvTimeOut != 0 && Time.realtimeSinceStartup >= lastBeatRecvTimeOut)
            {
                PromptDisconnect();
                return;
            }
        }

        fCheckTimer += Time.deltaTime;
        if (fCheckTimer > 3f)
        {
            fCheckTimer = 0f;

            //Debug.LogError("Check one time");
            if (client == null || !client.Connected)
            {
                PromptDisconnect();
                return;
            }
        }
    }
Example #28
0
        public void AddBomb(BaseBomb logic, bool is_foucs)
        {
            GameObject bombView = GameGOW.Get().ResourceMgr.GetRes("Prefab/BaseBomb");

            bombView.transform.position = new Vector3(logic.Position.x, logic.Position.y, 5);
            BombView view = bombView.GetComponent <BombView>();

            view.SetBombLogic(logic);
            view.transform.parent   = m_pZSort;
            m_dicBombView[logic.ID] = view;

            if (is_foucs)
            {
                m_pCamera.SetFocus(bombView.transform);
            }
        }
Example #29
0
 public static string GetTankInfo(string type, int id)
 {
     if (type == "NAME")
     {
         return(GameGOW.Get().DataMgr.GetCharacterInstructionByID(id).default_name);
     }
     if (type == "SKILL")
     {
         return(GameGOW.Get().DataMgr.GetCharacterInstructionByID(id).self_skill.ToString());
     }
     if (type == "DECRIP")
     {
         return(GameGOW.Get().DataMgr.GetCharacterInstructionByID(id).description);
     }
     return("????");
 }
Example #30
0
 IEnumerator DelayNet(int Bombid, bool kind, float x, float y) //延迟发炮,delay_time 为延迟时间
 {
     while (GameGOW.Get().BombMgr.GetBombByUID(Bombid) == null)
     {
         yield return(null);
     }
     GameGOW.Get().BombMgr.GetBombByUID(Bombid).Boom_pos = new Vector2(x, y);
     if (kind == false)
     {
         GameGOW.Get().BombMgr.GetBombByUID(Bombid).Net_Boom_Status = 1;
         //BaseBomb.Net_Boom_Status = 1;
     }
     else
     {
         GameGOW.Get().BombMgr.GetBombByUID(Bombid).Net_Boom_Status = 2;
         //BaseBomb.Net_Boom_Status = 2;
     }
 }