Пример #1
0
        /**本角色与游戏对象(场景传送点,副本传送点,NPC,怪物,BOSS)碰撞时回调**/
        override public void hitCallback(BaseDisplay display)
        {
            switch (display.Type)
            {
            case DisplayType.MAP_POINT:
                HitMapPoint();
                break;

            case DisplayType.NPC:
                var npcId = display.GetVo().Id;
                if (npcId == NpcIdConst.NpcWantedTask)
                {
                    /*if (me.GetVo().Level < 36)
                     * {
                     *  var message = LanguageManager.GetWord("AppMap.WantedTaskLimit");
                     *  MessageManager.Show(message);
                     * }
                     * else
                     * {
                     *  if (TaskModel.Instance.CurrentSubTaskVo != null)
                     *  {
                     *      var message = LanguageManager.GetWord("AppMap.WantedTaskRemind");
                     *      MessageManager.Show(message);
                     *  }
                     *  else
                     *  {
                     *      Singleton<WantedTaskView>.Instance.OpenView();
                     *  }
                     * }*/
                    //暂时屏蔽掉悬赏任务入口
                }
                else
                {
                    Singleton <NpcDialogModel> .Instance.CurrentNpcId = display.GetVo().Id;
                    Singleton <NpcDialogView> .Instance.OpenView();
                }
                break;
            }
        }
Пример #2
0
        /// <summary>
        ///     过两帧再添加怪物的其他显示信息,避免出现这些其他信息提前出现引起混乱
        /// </summary>
        /// <param name="display"></param>
        /// <returns></returns>
        private IEnumerator AddMonsterAdditionalView(BaseDisplay display)
        {
            //隔1帧再显示血条信息
            //yield return 0;
            var monsterDisplay = display as MonsterDisplay;

            display.GoCloth.transform.localPosition = new Vector3(0, 0, -30);
            if (display.Controller != null)
            {
                //添加名字UI
                GameObject child = NGUITools.AddChild(display.Controller.gameObject);
                if (monsterDisplay != null)
                {
                    BoxCollider2D boxCollider2D = monsterDisplay.BoxCollider2D;
                    float         y             = (boxCollider2D.center.y + boxCollider2D.size.y / 2) * display.GoCloth.transform.localScale.y;
                    child.transform.localPosition = new Vector3(0f, y + 0.3f, 0f);
                    child.name = "pivot";
                    var item = display.GetVo() as MonsterVo;
                    if (item != null)
                    {
                        var actionControler = display.Controller as ActionControler;
                        if (actionControler != null)
                        {
                            //以下三行预处理的是怪物说话信息
                            GameObject myBossMsg = HudView.Instance.AddItem("msg", child.transform, HudView.Type.Monster);
                            actionControler.GoBossMsg = myBossMsg;
                            monsterDisplay.InitSpeakView(myBossMsg);
                        }
                        AppMap.Instance.AddMonster(monsterDisplay);
                    }
                    //新增怪物刷出特效

                    /* if ((display.GetMeVoByType<MonsterVo>()).bornType != 3) //3为空中掉下来的怪物,不播放这个出生特效
                     * {
                     *  ShowMonsterSpawnEffect(display.Controller.transform.position);
                     * }*/
                    //display.ShowBornModelEffect();
                    monsterDisplay.ReadyToUseAi(AiStartDelayTime);
                }
            }
            yield return(0);
        }
Пример #3
0
        private void LoadPlayerModelBack(BaseDisplay display)
        {
            var player = display as PlayerDisplay;
            //名称
            GameObject name = NGUITools.AddChild(display.Controller.gameObject);

            player.ChangeDire(Directions.Right);
            BoxCollider2D boxCollider2D = player.BoxCollider2D;
            float         y             = (boxCollider2D.center.y + boxCollider2D.size.y * 0.5f) * display.GoCloth.transform.localScale.y;

            ;
            name.name = "name";
            Transform mTrans = name.transform;

            mTrans.localPosition = new Vector3(0f, y + 0.2f, 0f);
            GameObject goName = HudView.Instance.AddItem(display.GetVo().Name, mTrans, HudView.Type.Player);

            (player.Controller as ActionControler).GoName = goName;

            if ((AppMap.Instance.mapParser.MapId == MapTypeConst.ARENA_MAP) ||
                (AppMap.Instance.mapParser.MapId == MapTypeConst.GoldSilverIsland_MAP))
            {
                display.Controller.AiController.SetAi(true); //英雄榜刚开始启用AI
            }
            else
            {
                display.Controller.AiController.SetAi(false);
            }
            if (SystemSettingMode.Instance.HidePlayer && MeVo.instance.mapId != MapTypeConst.ARENA_MAP && MeVo.instance.mapId != MapTypeConst.GoldSilverIsland_MAP)
            {
                //如果系统设置有设置隐藏玩家,则不显示玩家
                display.GoBase.SetActive(false);
                display.Controller.GoName.SetActive(false);
            }
            if (display.GetMeVoByType <BaseRoleVo>().CurHp == 0)
            {
                display.Controller.StatuController.SetStatu(Status.DEATH);  //血量为0时设置为死亡状态
            }
            player.GetMeVoByType <PlayerVo>().UpdatePetDisplay();
        }
Пример #4
0
        //本角色创建成功回调
        private void LoadMeCallBack(BaseDisplay display)
        {
            _myCamera = Camera.main.gameObject.AddMissingComponent <MyCamera>();
            GameObject name          = NGUITools.AddChild(display.Controller.gameObject);
            var        playerDisplay = display as PlayerDisplay;

            if (playerDisplay != null)
            {
                BoxCollider2D boxCollider2D = playerDisplay.BoxCollider2D;
                float         y             = (boxCollider2D.center.y + boxCollider2D.size.y / 2) * display.GoCloth.transform.localScale.y;
                name.name = "name";
                Transform mTrans = name.transform;
                mTrans.localPosition = new Vector3(0f, y + 0.3f, 0f);
                GameObject goName = HudView.Instance.AddItem(display.GetVo().Name, mTrans, HudView.Type.Player);
                display.Controller.GoName = goName;
            }
            InitMePos();
            AppMap.Instance.me.ChangeDire(Directions.Right);
            SetHeroIdleType();
            _myCamera.Init();
            AppMap.Instance.me.Controller.AiController.SetAi(false);
            ChangeSceneOk();
            MeVo.instance.UpdatePetDisplay();
        }