Example #1
0
 void OnDisable()
 {
     if (trigger == Trigger.OnDisable)
     {
         AudioManger.Get().PlayEffect(audioClip, volume);
     }
 }
Example #2
0
    /// <summary>
    /// 更新倒计时窗口
    /// </summary>
    private void UpdateStartCountTime()
    {
        // 倒计时
        --startCountTime;

        if (startCountTime > 0)
        {
            // 显示
            timeLabel.text = string.Format("{0}", startCountTime);
            AudioManger.Get().PlayEffect("click");
            timeLabel.transform.parent.gameObject.SetActive(true);
        }
        else
        {
            timeLabel.transform.parent.gameObject.SetActive(false);
        }

        if (startCountTime <= 0)
        {
            // 进入游戏,先还是不改变之前的流程,全部收到包时就进入游戏页,然后让这个页盖上它,倒计时
            OnCloseClick();
        }
        else
        {
            Invoke("UpdateStartCountTime", 1.0f);
        }
    }
Example #3
0
 void OnClick()
 {
     if (canPlay && trigger == Trigger.OnClick)
     {
         AudioManger.Get().PlayEffect(audioClip, volume);
     }
 }
Example #4
0
 public override void OnShow()
 {
     base.OnShow();
     SetPlayerInfo();
     AudioManger.Get().PlayAudioBG("Empty");
     //string[] strName = gameObject.name.Split('(');
     //GuideManager.StartGuide(GuildCondition.GC_Ui, strName[0], gameObject);
 }
Example #5
0
    public override void OnShow()
    {
        base.OnShow();
        // 隐藏所有位置节点
        for (int i = 0; i < posRoots.Length; ++i)
        {
            posRoots [i].SetActive(false);
        }

        AudioManger.Get().PlayAudioBG("Wandering");
    }
Example #6
0
    /// <summary>
    /// Call the listener function.
    /// </summary>

    protected virtual void OnClick()
    {
        if (current == null && isEnabled && UICamera.currentTouchID != -2 && UICamera.currentTouchID != -3)
        {
            current = this;
                        #if !SERVER
            //Debug.Log ("Play click");
            AudioManger.Get().PlayEffect(clickSound, clickSoundVolumn);
                        #endif
            EventDelegate.Execute(onClick);
            current = null;
        }
    }
Example #7
0
    public void OnClickEnglish(GameObject go)
    {
        AudioManger.Get().PlayEffect("click_down");
        SystemLanguage curLanguage = (SystemLanguage)LocalAccountStorage.Get().localLanguage;

        if (curLanguage == SystemLanguage.English)
        {
            return;
        }

        SelectLanguage = SystemLanguage.English;
        UISystem.Get().ShowWindow("CommonDialogWindow");
        UISystem.Get().OnEventHandler((int)EventId.OnCommonDialog, "CommonDialogWindow",
                                      2, LanguageDataProvider.GetValue(208), new EventDelegate(ModifyLanguange));
    }
Example #8
0
    void OnPress(bool isPressed)
    {
        if (trigger == Trigger.OnPress)
        {
            if (mIsOver == isPressed)
            {
                return;
            }
            mIsOver = isPressed;
        }

        if (canPlay && ((isPressed && trigger == Trigger.OnPress) || (!isPressed && trigger == Trigger.OnRelease)))
        {
            AudioManger.Get().PlayEffect(audioClip, volume);
        }
    }
Example #9
0
    void OnHover(bool isOver)
    {
        if (trigger == Trigger.OnMouseOver)
        {
            if (mIsOver == isOver)
            {
                return;
            }
            mIsOver = isOver;
        }

        if (canPlay && ((isOver && trigger == Trigger.OnMouseOver) || (!isOver && trigger == Trigger.OnMouseOut)))
        {
            AudioManger.Get().PlayEffect(audioClip, volume);
        }
    }
Example #10
0
    public void OnSoundClick(GameObject go)
    {
        LocalSettingStorage.Get().sound = !LocalSettingStorage.Get().sound;
        SetPage();

        // 播放/停止音效
        if (LocalSettingStorage.Get().sound)
        {
            AudioManger.Get().PlayEffect("click_down");
            AudioManger.Get().MuteEffectAudio(false);
        }
        else
        {
            AudioManger.Get().MuteEffectAudio(true);
        }
    }
Example #11
0
 public void OnMusicClick(GameObject go)
 {
     LocalSettingStorage.Get().music = !LocalSettingStorage.Get().music;
     SetPage();
     AudioManger.Get().PlayEffect("click_down");
     // 播放/停止背景音
     if (LocalSettingStorage.Get().music)
     {
         AudioManger.Get().MuteBGAudio(false);
         AudioManger.Get().PlayAudioBG("Empty");
     }
     else
     {
         AudioManger.Get().MuteBGAudio(true);
     }
 }
Example #12
0
    public override void OnShow()
    {
        base.OnShow();
        InvokeRepeating("UpdateTime", 0f, 1.0f);

        // 隐藏所有位置节点
        for (int i = 0; i < posRoots.Length; ++i)
        {
            posRoots [i].SetActive(false);
        }

        AudioManger.Get().PlayAudioBG("Wandering");

        tips.gameObject.SetActive(false);

        // 设置房间显示数据
        SetPage(true);
    }
Example #13
0
    public void Init()
    {
        // 初始化
        if (Framework.Instance.Init())
        {
            LoggerSystem.Instance.Info("系统启动!");
        }
        else
        {
            LoggerSystem.Instance.Error("系统启动失败!");
        }

        AsyncInitMsg();

        AudioManger.Get().Init();
        BattleSystem.Instance.battleData.root = battleRoot;

        /// 出示数据统计
        Flurry.Instance.FlurryInit();
        Flurry.Instance.LogUserID(LocalAccountStorage.Get().account);

        initFinished = true;
    }
Example #14
0
    public void CreateScene(bool isEditer, MapConfig table, IList <int> usr = null, bool isHaveRandom = false)
    {
        battleData.currentTable = table;

        //创建星球
        CreateNode(table.mbcList);

        //创建障碍物
        CreateLines(table.mlcList);

        //创建动态阻挡
        CreateBarrierPoints(table.mbcList);

        //创建飞船
        CreateShip(table.mpcList);

        #if !SERVER
        //播放音乐
        if (!isEditer)
        {
            AudioManger.Get().PlayAudioBG("Wandering");
        }
        #endif
    }
Example #15
0
    public override void OnUIEventHandler(EventId eventId, params object[] args)
    {
        if (eventId == EventId.OnMatchInit)
        {
            // room init
            matchId = (string)args [0];
            roomId  = (string)args [1];
            IList <NetMessage.UserData> userList = (IList <NetMessage.UserData>)args [2];
            IList <int> userIndexList            = (IList <int>)args [3];
            hostId    = (int)args [4];
            playerNum = (int)args[5];

            // format data
            int nPlayerCount = 0;
            for (int i = 0; i < userList.Count; ++i)
            {
                PlayerData pd = new PlayerData();
                if (pd.userId > 0)
                {
                    nPlayerCount++;
                }
                pd.Init(userList [i]);
                int index = userIndexList [i];
                allPlayers [index] = pd;
            }

            SetModelPage();
            SetPage();
            Flurry.Instance.FlurryPVPBattleMatchEvent("1", matchId, "0", nPlayerCount.ToString(), roomId);
        }
        else if (eventId == EventId.OnMatchUpdate)
        {
            // room update

            IList <NetMessage.UserData> userAddList = (IList <NetMessage.UserData>)args [0];
            IList <int>  userIndexAddList           = (IList <int>)args [1];
            IList <int>  userIndexDeleteList        = (IList <int>)args [2];
            IList <bool> userKickList       = (IList <bool>)args [3];
            IList <int>  userChangeFromList = (IList <int>)args [4];
            IList <int>  userChangeToList   = (IList <int>)args [5];
            if (args.Length == 7)
            {
                hostId = (int)args [6];
            }

            for (int i = 0; i < userIndexDeleteList.Count; ++i)
            {
                int index = userIndexDeleteList [i];

                if (allPlayers [index] != null && allPlayers [index].userId == LocalPlayer.Get().playerData.userId)
                {
                    // 自己退出,则关闭页面
                    UISystem.Instance.HideWindow("RoomWaitWindow");
                    UISystem.Instance.ShowWindow("CreateRoomWindow");

                    if (userKickList [i])
                    {
                        // 被踢
                        Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.GetValue(909), 1.0f);
                    }
                }

                allPlayers [index] = null;
            }
            // add
            for (int i = 0; i < userAddList.Count; ++i)
            {
                PlayerData pd = new PlayerData();
                pd.Init(userAddList [i]);
                int index = userIndexAddList [i];
                allPlayers [index] = pd;
            }
            // change pos
            for (int i = 0; i < userChangeFromList.Count; ++i)
            {
                AudioManger.Get().PlayEffect("onOpen");
                int from = userChangeFromList [i];
                int to   = userChangeToList [i];

                PlayerData temp = allPlayers [from];
                allPlayers [from] = allPlayers [to];
                allPlayers [to]   = temp;
            }

            SetPage();
        }
        else if (eventId == EventId.OnMatchQuit)
        {
            // quit , 谁触发的quit,谁收到quit,
            NetMessage.ErrCode code = (NetMessage.ErrCode)args [0];
            if (code == NetMessage.ErrCode.EC_NotMaster)
            {
                Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.GetValue(905), 1.0f);
            }
            else if (code != NetMessage.ErrCode.EC_Ok)
            {
                Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.Format(901, code), 1.0f);
            }
            else if (code == NetMessage.ErrCode.EC_Ok)
            {
                UISystem.Get().HideAllWindow();
                UISystem.Get().ShowWindow("CreateRoomWindow");
            }
        }
    }
Example #16
0
 public void PlaySingleStarSound()
 {
     AudioManger.Get().PlayEffect("starSound");
 }
Example #17
0
 public void Play()
 {
     AudioManger.Get().PlayEffect(audioClip, volume);
 }
Example #18
0
    /// <summary>
    /// 设置页面信息
    /// </summary>
    private void SetPage()
    {
        MapConfig   map        = MapConfigProvider.Instance.GetData(mapId);
        List <Team> groupTeams = new List <Team> ();
        // 胜利方
        Team selfTeam = BattleSystem.Instance.sceneManager.teamManager.GetTeam(BattleSystem.Instance.battleData.currentTeam);
        Team winTeam  = null;
        bool timeout  = false;

        CalculateWinTeam(map, out winTeam, out timeout);

        // 胜利方的友方
        bool showwin = false;

        for (int i = 0; i < map.player_count; ++i)
        {
            TEAM T = (TEAM)(i + 1);
            Team t = BattleSystem.Instance.sceneManager.teamManager.GetTeam(T);
            if (t != winTeam && winTeam.IsFriend(t.groupID))
            {
                groupTeams.Add(t);
            }
            else if (t == winTeam)
            {
                groupTeams.Add(t);
            }
        }
        if (groupTeams.Count > 0)
        {
            showwin = true;
            groupTeams.Sort((arg0, arg1) => {
                int ret = arg0.resultOrder.CompareTo(arg1.resultOrder);
                if (ret == 0)
                {
                    ret = arg0.scoreMod.CompareTo(arg1.scoreMod);
                }
                if (ret == 0)
                {
                    ret = arg0.destory.CompareTo(arg1.destory);
                }
                return(-ret);
            });
        }

        // 失败方
        List <Team> failTeams = new List <Team>();

        for (int i = 0; i < map.player_count; ++i)
        {
            TEAM T = (TEAM)(i + 1);
            Team t = BattleSystem.Instance.sceneManager.teamManager.GetTeam(T);
            if (t != winTeam && !winTeam.IsFriend(t.groupID) && !groupTeams.Contains(t))
            {
                failTeams.Add(t);
            }
        }
        failTeams.Sort((arg0, arg1) => {
            int ret = arg0.resultOrder.CompareTo(arg1.resultOrder);
            if (ret == 0)
            {
                ret = arg0.scoreMod.CompareTo(arg1.scoreMod);
            }
            if (ret == 0)
            {
                ret = arg0.hitships.CompareTo(arg1.hitships);
            }
            return(-ret);
        });

        groupTeams.AddRange(failTeams);
        if (groupTeams.Contains(selfTeam))
        {
            // 此场战斗中包含自己
            // 判断mvp还是胜利
            if (timeout)
            {
                // 平局
                result.text = LanguageDataProvider.GetValue(110);
            }
            else
            {
                if (selfTeam == winTeam)
                {
                    // 注意此种逻辑只能在胜方包含己方时,因为重播如果有可能win和self都是neutral
                    // mvp
                    result.text = LanguageDataProvider.GetValue(105);
                }
                else if (selfTeam.scoreMod > 0)
                {
                    // 胜利
                    result.text = LanguageDataProvider.GetValue(100);
                }
                else
                {
                    // 失败
                    result.text = LanguageDataProvider.GetValue(101);
                }
            }
            // 音效
            if (selfTeam.scoreMod > 0)
            {
                AudioManger.Get().PlayEffect("onPVPvictory");
            }
            else
            {
                AudioManger.Get().PlayEffect("onPVPdefeated");
            }
        }
        else
        {
            // 此场战斗不包含自己
            result.text = LanguageDataProvider.GetValue(106);
        }

        if (BattleSystem.Instance.battleData.gameType == GameType.PVP)
        {
            downGo.SetActive(true);
            confirmBtn.gameObject.SetActive(false);

            if (BattleSystem.Instance.battleData.battleSubType == NetMessage.CooperationType.CT_2V2)
            {
                if (selfTeam.scoreMod > 0)
                {
                    // 胜利
                    result.text = LanguageDataProvider.GetValue(100);
                }
                else
                {
                    // 失败
                    result.text = LanguageDataProvider.GetValue(101);
                }
            }
            else
            {
                // 设置名次
                if (selfTeam.resultRank >= 0)
                {
                    string[] ranks = LanguageDataProvider.GetValue(107).Split(',');
                    int      rank  = map.player_count - selfTeam.resultRank - 1;/// note: resultRank最后一名是0,第一名是3,和一二三四有个倒序关系
                    result.text = LanguageDataProvider.Format(108, ranks[rank]);
                }
                else
                {
                    result.text = LanguageDataProvider.Format(106);
                }
            }
        }
        else
        {
            downGo.SetActive(false);
            confirmBtn.gameObject.SetActive(true);

            // 设置名次
            if (selfTeam.resultEndtype == NetMessage.EndType.ET_Win)
            {
                result.text = LanguageDataProvider.Format(109, selfTeam.leagueMvp);
            }
            else
            {
                if (selfTeam.resultRank >= 0)
                {
                    string[] ranks = LanguageDataProvider.GetValue(107).Split(',');
                    int      rank  = map.player_count - selfTeam.resultRank - 1;             /// note: resultRank最后一名是0,第一名是3,和一二三四有个倒序关系
                    result.text = LanguageDataProvider.Format(108, ranks [rank]);
                }
                else
                {
                    result.text = LanguageDataProvider.Format(106);
                }
            }
        }

        // 根据类型和人数判断选用哪种模式
        for (int i = 0; i < groupTeams.Count; ++i)
        {
            Team t = groupTeams [i];
            SetPosInfo(i, t, t.scoreMod, t.hitships, winTeam);
        }

        if (winTeam.team != TEAM.Neutral)
        {
            IsNeedPlayMvpEffect = true;
        }

        float  totalTime = BattleSystem.Instance.sceneManager.GetBattleTime();
        string matchType = "1";

        if (BattleSystem.Instance.battleData.gameType != GameType.PVP || BattleSystem.Instance.battleData.gameType != GameType.League)
        {
            matchType = "0";
        }
        Flurry.Instance.FlurryPVPBattleEndEvent(matchType, mapId, selfTeam.scoreMod.ToString(), selfTeam.hitships.ToString(), selfTeam.destory.ToString(), totalTime.ToString());
    }