Пример #1
0
 void OnApply()
 {
     if (!string.IsNullOrEmpty(Nick.text))
     {
         GameStateMgr.Ins.gameStatus.NickName = Nick.text;
         if (SettingDialogState.Exist)
         {
             SettingDialogState.Instance.OnRefresh(0, null);
         }
         OnBackPress();
     }
     else
     {
         U3D.PopupTip("昵称不能为空");
     }
 }
    void InsertPlayerResult(int instanceId, BattleResultItem result)
    {
        GameObject obj = GameObject.Instantiate(Resources.Load <GameObject>("ResultItem"));

        if (Main.Ins.CombatData.GGameMode == GameMode.MENGZHU)
        {
            obj.transform.SetParent(BattleResultAll.transform);
        }
        else
        {
            obj.transform.SetParent(result.camp == (int)EUnitCamp.EUC_FRIEND ? MeteorResult : ButterflyResult);
        }
        obj.layer = MeteorResult.gameObject.layer;
        obj.transform.localRotation = Quaternion.identity;
        obj.transform.localScale    = Vector3.one;
        obj.transform.localPosition = Vector3.zero;

        Text Idx    = Control("Idx", obj).GetComponent <Text>();
        Text Name   = Control("Name", obj).GetComponent <Text>();
        Text Killed = Control("Killed", obj).GetComponent <Text>();
        Text Dead   = Control("Dead", obj).GetComponent <Text>();

        Idx.text  = (result.id + 1).ToString();
        Name.text = U3D.GetUnit(instanceId).Name;
        if (Main.Ins.CombatData.GGameMode == GameMode.MENGZHU)
        {
        }
        else
        {
            Text Camp = Control("Camp", obj).GetComponent <Text>();
            Camp.text = U3D.GetCampStr((EUnitCamp)result.camp);
        }
        Killed.text = result.killCount.ToString();
        Dead.text   = result.deadCount.ToString();
        MeteorUnit u = U3D.GetUnit(result.id);

        if (u != null)
        {
            if (u.Dead)
            {
                Idx.color    = Color.red;
                Name.color   = Color.red;
                Killed.color = Color.red;
                Dead.color   = Color.red;
            }
        }
    }
Пример #3
0
    static void OnPlayerLeave(RBase req)
    {
        PlayerEnterMap remove = req as PlayerEnterMap;

        if (remove != null)
        {
            //把场景上的此玩家删除掉.
            string strTip = "玩家:";
            foreach (var each in remove.insertPlayer)
            {
                strTip += each.Value.Name + " ";
            }
            strTip += "离开";
            U3D.PopupTip(strTip);
            //insert.insertPlayer;
        }
    }
Пример #4
0
    static void OnPlayerInsert(RBase req)
    {
        PlayerEnterMap insert = req as PlayerEnterMap;

        if (insert != null)
        {
            //把场景上的此玩家删除掉.
            string strTip = "玩家:";
            foreach (var each in insert.insertPlayer)
            {
                strTip += each.Value.Name + " ";
            }
            strTip += "进入";
            U3D.PopupTip(strTip);
            //insert.insertPlayer;
        }
    }
Пример #5
0
    public void DropWeapon(MeteorUnit player)
    {
        int mainWeapon = player.Attr.Weapon2;

        if (mainWeapon == 0)
        {
            return;
        }
        ItemData   ib      = DataMgr.Ins.GetItemData(mainWeapon);
        WeaponData wb      = U3D.GetWeaponProperty(ib.UnitId);
        GameObject trigget = CreateTriggerObj(wb.WeaponR, player.transform.position, -player.transform.forward);

        //obj.Add(trigget);
        //ExplosionObject01.iTweenExplosion01(1, ref obj, player.transform.position);
        player.Attr.Weapon2 = 0;
        ExplosionObject01.DropItem(trigget, player.transform.position, (-1 * player.transform.forward), 100, 10);
    }
 void OnCreateRoom()
 {
     if (select != null)
     {
         //Global.Instance.PlayerLife = GameData.Instance.gameStatus.NetWork.Life;
         //Global.Instance.RoundTime = GameData.Instance.gameStatus.NetWork.RoundTime;
         //Global.Instance.MaxPlayer = GameData.Instance.gameStatus.NetWork.MaxPlayer;
         if (string.IsNullOrEmpty(roomName.text))
         {
             U3D.PopupTip("需要设置房间名");
             return;
         }
         Main.Ins.GameStateMgr.gameStatus.NetWork.RoomName = roomName.text;
         Common.CreateRoom(roomName.text, roomSecret.text);
         //U3D.LoadLevel(select.ID, LevelMode.CreateWorld, (GameMode)GameData.Instance.gameStatus.NetWork.Mode);
     }
 }
Пример #7
0
    public MonsterEx InitNetPlayer(PlayerEventData player)
    {
        MonsterEx ret = new MonsterEx();

        ret.HpMax      = (int)Main.Ins.RoomMng.GetRoom(Main.Ins.NetWorkBattle.RoomId).hpMax;
        ret.hpCur      = ret.HpMax;
        ret.AngryValue = 0;
        ret.Model      = (int)player.model;
        ret.Weapon     = (int)player.weapon;
        ret.Weapon2    = (int)0;
        ret.name       = player.name;

        ret.SpawnPoint = U3D.Rand(16);
        ret.Speed      = 1000;
        ret.IsPlayer   = player.playerId == Main.Ins.NetWorkBattle.PlayerId;
        return(ret);
    }
Пример #8
0
    void Init()
    {
        Control("Continue").GetComponent <Button>().onClick.AddListener(OnClickClose);
        Control("BGMSlider").GetComponent <Slider>().value    = GameStateMgr.Ins.gameStatus.MusicVolume;
        Control("EffectSlider").GetComponent <Slider>().value = GameStateMgr.Ins.gameStatus.SoundVolume;
        Control("HSliderBar").GetComponent <Slider>().value   = GameStateMgr.Ins.gameStatus.AxisSensitivity.x;
        Control("VSliderBar").GetComponent <Slider>().value   = GameStateMgr.Ins.gameStatus.AxisSensitivity.y;
        Control("HValue").GetComponent <Text>().text          = string.Format("{0:f1}", GameStateMgr.Ins.gameStatus.AxisSensitivity.x);
        Control("VValue").GetComponent <Text>().text          = string.Format("{0:f1}", GameStateMgr.Ins.gameStatus.AxisSensitivity.y);
        Control("BGMSlider").GetComponent <Slider>().onValueChanged.AddListener(OnMusicVolumeChange);
        Control("EffectSlider").GetComponent <Slider>().onValueChanged.AddListener(OnEffectVolumeChange);
        Control("HSliderBar").GetComponent <Slider>().onValueChanged.AddListener(OnXSensitivityChange);
        Control("VSliderBar").GetComponent <Slider>().onValueChanged.AddListener(OnYSensitivityChange);
        //返回主界面
        Control("QuitGame").GetComponent <Button>().onClick.AddListener(OnClickQuit);
        Control("ResetPosition").GetComponent <Button>().onClick.AddListener(OnResetPosition);
        Control("SetPosition").GetComponent <Button>().onClick.AddListener(OnSetJoyPosition);

        Control("Snow").GetComponent <Button>().onClick.AddListener(() => { U3D.Snow(); });
        Control("DoScript").GetComponent <Button>().onClick.AddListener(() => { U3D.DoScript(); OnClickClose(); });

        Control("ChangeModel").GetComponent <Button>().onClick.AddListener(() => { Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.ModelSelectDialogState); });

        //观察AI行为,调试AI是否存在问题
        Toggle toggleFollowEnemy = Control("FollowEnemy").GetComponent <Toggle>();

        toggleFollowEnemy.isOn = U3D.WatchAi;
        OnFollowEnemy(U3D.WatchAi);
        toggleFollowEnemy.onValueChanged.AddListener(OnFollowEnemy);

        Control("PrevRobot").GetComponent <Button>().onClick.AddListener(U3D.WatchPrevRobot);
        Control("NextRobot").GetComponent <Button>().onClick.AddListener(U3D.WatchNextRobot);

        Control("Mission").GetComponent <Text>().text   = GetMission();
        Control("LevelDesc").GetComponent <Text>().text = GetLevelDesc();
        Control("MissionTab").gameObject.SetActive(CombatData.Ins.GLevelMode == LevelMode.SinglePlayerTask);
        //把一些模式禁用,例如作弊之类的.
        if (GameStateMgr.Ins.gameStatus.CheatEnable)
        {
        }
        else
        {
            Control("ChangeModel").gameObject.SetActive(CombatData.Ins.GLevelMode == LevelMode.MultiplyPlayer);
            Control("Snow").SetActive(CombatData.Ins.GLevelMode == LevelMode.MultiplyPlayer);
        }
    }
 void OnChangeVer(string ver)
 {
     if (Main.Ins.AppInfo.MeteorVersion == ver)
     {
         U3D.PopupTip(string.Format("当前流星版本已为{0}", ver));
         return;
     }
     Main.Ins.AppInfo.MeteorVersion = ver;
     Main.Ins.GameStateMgr.gameStatus.MeteorVersion = Main.Ins.AppInfo.MeteorVersion;
     Main.Ins.GameStateMgr.SaveState();
     if (GameOverlayDialogState.Exist())
     {
         GameOverlayDialogState.Instance.ClearSystemMsg();
     }
     OnBackPress();
     U3D.ReStart();
 }
Пример #10
0
    int actionPrev = 0;//上一个动作
    public void SyncMainPlayer()
    {
        Frame = new GameFrame();
        FrameCommand cmd = new FrameCommand();

        cmd.playerId = (uint)Main.Ins.LocalPlayer.InstanceId;
        cmd.command  = MeteorMsg.Command.ClientSync;
        MemoryStream ms     = new MemoryStream();
        PlayerSync   sync   = new PlayerSync();
        MeteorUnit   player = Main.Ins.LocalPlayer;

        sync.playerId   = (uint)player.InstanceId;
        sync.position   = new _Vector3();
        sync.position.x = Mathf.FloorToInt(player.transform.position.x * 1000);
        sync.position.y = Mathf.FloorToInt(player.transform.position.y * 1000);
        sync.position.z = Mathf.FloorToInt(player.transform.position.z * 1000);
        sync.rotation   = new _Quaternion();
        sync.rotation.x = Mathf.FloorToInt(player.transform.rotation.x * 1000);
        sync.rotation.y = Mathf.FloorToInt(player.transform.rotation.y * 1000);
        sync.rotation.z = Mathf.FloorToInt(player.transform.rotation.z * 1000);
        sync.rotation.w = Mathf.FloorToInt(player.transform.rotation.w * 1000);
        sync.model      = (uint)player.ModelId;
        sync.weapon     = (uint)player.Attr.Weapon;
        sync.weapon1    = (uint)player.Attr.Weapon2;
        sync.hp         = (uint)player.Attr.hpCur;
        sync.ang        = (uint)player.AngryValue;
        sync.action     = -1;

        if (actionPrev != player.ActionMgr.mActiveAction.Idx)
        {
            sync.action = player.ActionMgr.mActiveAction.Idx;
            actionPrev  = player.ActionMgr.mActiveAction.Idx;
        }

        List <int> buffs = U3D.GetUnitBuffs(player);

        for (int i = 0; i < buffs.Count; i++)
        {
            sync.buff.Add((uint)buffs[i]);
        }

        ProtoBuf.Serializer.Serialize <PlayerSync>(ms, sync);
        cmd.Data = ms.ToArray();
        Frame.commands.Add(cmd);
    }
Пример #11
0
 public void AttachDlc(Chapter chapter)
 {
     Chapter = chapter;
     Function.onClick.RemoveAllListeners();
     Function.onClick.AddListener(() => {
         if (Chapter.Installed)
         {
             Main.Ins.CombatData.Chapter = Chapter;
             string tip = "";
             if (!Main.Ins.DlcMng.CheckDependence(Main.Ins.CombatData.Chapter, out tip))
             {
                 Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.LevelDialogState, false);
             }
             else
             {
                 U3D.PopupTip("Dlc依赖\n" + tip);
             }
         }
         else
         {
             U3D.PopupTip("安装后可查看");
         }
     });
     //已经安装
     if (Main.Ins.GameStateMgr.gameStatus.IsDlcInstalled(Chapter))
     {
         Chapter.Installed = true;
         Install.GetComponentInChildren <Text>().text = StringUtils.Uninstall;
         wantPercent = 100;
         //从本地读取一张图片,作为预览图
         if (System.IO.File.Exists(Chapter.Preview))
         {
             byte[]    array = System.IO.File.ReadAllBytes(Chapter.Preview);
             Texture2D tex   = new Texture2D(0, 0);
             tex.LoadImage(array);
             Preview.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
         }
     }
     else
     {
     }
     Title.text          = string.Format(StringUtils.DlcName, Chapter.Name);
     Desc.text           = Chapter.Desc ?? "";
     Progress.fillAmount = 0;
 }
Пример #12
0
 public void OnDisconnect()
 {
     if (GameBattleEx.Instance && RoomId != -1)
     {
         //在联机战斗场景中.
         GameBattleEx.Instance.Pause();
         SoundManager.Instance.StopAll();
         BuffMng.Instance.Clear();
         MeteorManager.Instance.Clear();
         FightWnd.Instance.Close();
         player.Clear();
         U3D.GoBack();
         bSync      = false;
         FrameIndex = ServerFrameIndex = 0;
     }
     RoomId   = -1;
     RoomName = "";
 }
Пример #13
0
    public void PlayEndMovie(bool play)
    {
        if (!string.IsNullOrEmpty(CombatData.GLevelItem.sceneItems) && play && CombatData.GLevelMode == LevelMode.SinglePlayerTask && CombatData.Chapter == null)
        {
            string num    = CombatData.GLevelItem.sceneItems.Substring(2);
            int    number = 0;
            if (int.TryParse(num, out number))
            {
                if (CombatData.GLevelItem.ID >= 0 && CombatData.GLevelItem.ID <= 9)
                {
                    string movie = string.Format(Main.strFile, Main.strHost, Main.port, Main.strProjectUrl, "mmv/" + "v" + number + ".mv");
                    U3D.PlayMovie(movie);
                }
            }
        }

        GotoMenu();
    }
Пример #14
0
 public void AutoDestroy()
 {
     //如果某人拾取了flag,不要再刷新镖物
     if (!U3D.GetFlag())
     {
         for (int i = 0; i < MeteorManager.Ins.SceneItems.Count; i++)
         {
             if (MeteorManager.Ins.SceneItems[i] != this &&
                 MeteorManager.Ins.SceneItems[i].ItemInfo != null &&
                 MeteorManager.Ins.SceneItems[i].ItemInfo.IsFlag())
             {
                 MeteorManager.Ins.SceneItems[i].OnRefresh();
                 break;
             }
         }
     }
     MeteorManager.Ins.OnDestroySceneItem(this);
     GameObject.Destroy(gameObject);
 }
Пример #15
0
    public static void UploadStart()
    {
        FileStream fs = null;

        UUID = SystemInfo.deviceUniqueIdentifier;
        string strfile  = Application.persistentDataPath + "/" + Application.platform + "_debug.log";
        string strfile2 = Application.persistentDataPath + "/" + Application.platform + "_error.log";

        if (File.Exists(strfile))
        {
            fs = File.Open(strfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            if (fs == null)
            {
                return;
            }
            if (fs.Length == 0)
            {
                fs.Close();
                return;
            }
        }
        else
        {
            U3D.PopupTip("无日志文件发送");
            return;
        }
        if (fs != null)
        {
            fs.Close();
        }

        DateTime time = DateTime.UtcNow;

        logFile.Clear();
        logFile.Add(strfile);
        logFile.Add(strfile2);

        if (uploadThread == null)
        {
            uploadThread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(FtpLog.UploadLog));
            uploadThread.Start();
        }
    }
Пример #16
0
 void OnEnterLevel()
 {
     if (select != null)
     {
         //单机全部是普通关卡对待.
         if (singlePlayer)
         {
             U3D.LoadLevel(select, LevelMode.SinglePlayerTask, GameMode.Normal);
         }
         else
         {
             Main.Ins.DlcMng.PlayDlc(Main.Ins.CombatData.Chapter, select.ID);
         }
         if (background.material == null)
         {
             OnBackPress();
         }
     }
 }
Пример #17
0
    void InsertPlayerResult(string name_, int id, int killed, int dead, EUnitCamp camp)
    {
        GameObject obj = GameObject.Instantiate(Resources.Load <GameObject>("ResultItem"));;

        obj.transform.SetParent(camp == EUnitCamp.EUC_FRIEND ? MeteorResult : ButterflyResult);
        obj.layer = MeteorResult.gameObject.layer;
        obj.transform.localRotation = Quaternion.identity;
        obj.transform.localScale    = Vector3.one;
        obj.transform.localPosition = Vector3.zero;

        Text Idx  = ldaControl("Idx", obj).GetComponent <Text>();
        Text Name = ldaControl("Name", obj).GetComponent <Text>();
        //Text Camp = ldaControl("Camp", obj).GetComponent<Text>();
        Text Killed = ldaControl("Killed", obj).GetComponent <Text>();
        Text Dead   = ldaControl("Dead", obj).GetComponent <Text>();

        Idx.text  = (id + 1).ToString();
        Name.text = name_;
        //Camp.text = result.camp == 1 ""
        Killed.text = killed.ToString();
        Dead.text   = dead.ToString();
        MeteorUnit u = U3D.GetUnit(id);

        if (u != null)
        {
            if (u.Dead)
            {
                Idx.color    = Color.red;
                Name.color   = Color.red;
                Killed.color = Color.red;
                Dead.color   = Color.red;
            }
        }
        else
        {
            //得不到信息了。说明该NPC被移除掉了
            Idx.color    = Color.red;
            Name.color   = Color.red;
            Killed.color = Color.red;
            Dead.color   = Color.red;
        }
    }
Пример #18
0
 //把某个物品叠加
 public bool JoinItem(int idx, uint cnt)
 {
     for (int i = 0; i < Item.Count; i++)
     {
         try
         {
             if (Item[i].Idx == idx && ((Item[i].Count + cnt) <= Item[i].Info().Stack))
             {
                 Item[i].Count += cnt;
                 string text = "得到物品:" + Item[i].Name() + ":" + cnt;
                 U3D.PopupTip(text);
                 return(true);
             }
         }
         catch
         {
         }
     }
     return(false);
 }
 void Init()
 {
     heroImg          = Control("Image").GetComponent <Image>();
     heroImg.material = ResMng.Load("Hero0") as Material;
     Control("Next").GetComponent <Button>().onClick.AddListener(() =>
     {
         OnNextHero();
         U3D.PlayBtnAudio();
     });
     Control("Prev").GetComponent <Button>().onClick.AddListener(() =>
     {
         OnPrevHero();
         U3D.PlayBtnAudio();
     });
     Control("Select").GetComponent <UIButtonExtended>().onClick.AddListener(() =>
     {
         OnSelectHero();
         U3D.PlayBtnAudio();
     });
 }
Пример #20
0
 void OnEnterLevel()
 {
     if (select != null)
     {
         CombatData.Ins.MainWeapon  = GameStateMgr.Ins.gameStatus.Single.Weapon0;
         CombatData.Ins.SubWeapon   = GameStateMgr.Ins.gameStatus.Single.Weapon1;
         CombatData.Ins.PlayerLife  = GameStateMgr.Ins.gameStatus.Single.Life;
         CombatData.Ins.PlayerModel = GameStateMgr.Ins.gameStatus.Single.Model;
         CombatData.Ins.RoundTime   = GameStateMgr.Ins.gameStatus.Single.RoundTime;
         CombatData.Ins.MaxPlayer   = GameStateMgr.Ins.gameStatus.Single.MaxPlayer;
         bool             isPluginLevel = true;
         List <LevelData> all           = DataMgr.Ins.GetLevelDatas();
         for (var i = 0; i < all.Count; i++)
         {
             if (all[i] == select)
             {
                 isPluginLevel = false;
                 break;
             }
         }
         if (isPluginLevel)
         {
             CombatData.Ins.Chapter = DlcMng.Ins.FindChapterByLevel(select);
             GameStateMgr.Ins.gameStatus.ChapterTemplate      = CombatData.Ins.Chapter.ChapterId;
             GameStateMgr.Ins.gameStatus.Single.LevelTemplate = select.Id;
         }
         else
         {
             GameStateMgr.Ins.gameStatus.ChapterTemplate      = 0;
             GameStateMgr.Ins.gameStatus.Single.LevelTemplate = select.Id;
             CombatData.Ins.Chapter = null;
         }
         LevelScriptBase script = LevelHelper.GetLevelScript(select.LevelScript);
         if (script == null)
         {
             U3D.PopupTip(string.Format("关卡脚本为空 关卡ID:{0}, 关卡脚本:{1}", select.Id, select.LevelScript));
             return;
         }
         U3D.LoadLevel(select, LevelMode.CreateWorld, (GameMode)GameStateMgr.Ins.gameStatus.Single.Mode);
     }
 }
Пример #21
0
    public void InitPlayer(LevelScriptBase script)
    {
        Team     = 1;
        IsPlayer = true;
        Speed    = 1000;
        if (script == null)
        {
            name       = StringUtils.DefaultPlayer;
            SpawnPoint = 0;
            SpawnDir   = 0;

            Weapon  = 51;
            Weapon2 = 47;
            HpMax   = hpCur = 10000;
        }
        else
        {
            name       = script.GetPlayerName();
            Model      = script.GetPlayerModel();
            SpawnPoint = script.GetPlayerSpawn();
            SpawnDir   = script.GetPlayerSpawnDir();//一个Z轴朝内,一个Z轴朝外,角度自己来换吧。
            Weapon     = (int)(double)script.GetPlayerWeapon();
            Weapon2    = (int)(double)script.GetPlayerWeapon2();
            HpMax      = hpCur = (int)(double)script.GetPlayerMaxHp();
            if (HpMax == 0)
            {
                hpCur = HpMax = 1000;
            }
            if (CombatData.Ins.GLevelMode == LevelMode.CreateWorld)
            {
                HpMax   = hpCur = 10 * CombatData.Ins.PlayerLife;
                Weapon  = U3D.GetWeaponByType(CombatData.Ins.MainWeapon);
                Weapon2 = U3D.GetWeaponByType(CombatData.Ins.SubWeapon);
                Model   = CombatData.Ins.PlayerModel;
                name    = DataMgr.Ins.GetModelDatas()[Model].Name;
            }
        }
        View       = 500;
        AngryValue = 0;
        IsDead     = false;
    }
Пример #22
0
    void Init()
    {
        RectTransform rectTran = WndObject.GetComponent <RectTransform>();

        if (rectTran != null)
        {
            rectTran.anchoredPosition = new Vector2((1920f - rectTran.sizeDelta.x) / 2.0f, -(1080f - rectTran.sizeDelta.y) / 2.0f);
        }
        GameObject      obj       = NodeHelper.Find("3DParent", WndObject);
        GameObject      objPlayer = GameObject.Instantiate(Resources.Load("3DUIPlayer")) as GameObject;
        MeteorUnitDebug d         = objPlayer.GetComponent <MeteorUnitDebug>();

        objPlayer.transform.position   = Vector3.zero;
        objPlayer.transform.rotation   = Quaternion.identity;
        objPlayer.transform.localScale = Vector3.one;
        d.gameObject.layer             = obj.gameObject.layer;
        d.Init(Main.Ins.LocalPlayer.UnitId, LayerMask.NameToLayer("3DUIPlayer"));
        WeaponDatas.WeaponDatas weaponProperty = U3D.GetWeaponProperty(Main.Ins.LocalPlayer.weaponLoader.GetCurrentWeapon().Info().UnitId);
        d.weaponLoader.StrWeaponR = weaponProperty.WeaponR;
        d.weaponLoader.StrWeaponL = weaponProperty.WeaponL;
        //d.weaponLoader.EquipWeapon();
        d.transform.SetParent(obj.transform);
        d.transform.localScale    = 8 * Vector3.one;
        d.transform.localPosition = new Vector3(0, 0, -300);
        d.transform.localRotation = Quaternion.identity;
        NodeHelper.Find("Close Button", WndObject).GetComponent <Button>().onClick.AddListener(OnBackPress);

        SetStat("Stat Label 1", Main.Ins.LocalPlayer.Attr.hpCur + "/" + Main.Ins.LocalPlayer.Attr.HpMax);
        SetStat("Stat Label 2", Main.Ins.LocalPlayer.AngryValue.ToString());
        SetStat("Stat Label 3", Main.Ins.LocalPlayer.CalcDamage().ToString());
        SetStat("Stat Label 4", Main.Ins.LocalPlayer.CalcDef().ToString());
        SetStat("Stat Label 5", Main.Ins.LocalPlayer.MoveSpeed.ToString());
        SetStat("Stat Label 6", string.Format("{0:f2}", Main.Ins.LocalPlayer.MoveSpeed / 1000.0f));

        //处理背包的点击
        UIItemSlot[] slots = NodeHelper.Find("Slots Grid", WndObject).GetComponentsInChildren <UIItemSlot>();
        for (int i = 0; i < slots.Length; i++)
        {
            slots[i].onClick.AddListener(OnClickItem);
        }
    }
 //断开连接时.
 public void OnDisconnect()
 {
     if (RoomId != -1)
     {
         KcpClient.Ins.Disconnect();
         //在联机战斗场景中.
         Main.Ins.GameBattleEx.Pause();
         SoundManager.Ins.StopAll();
         RoomId   = -1;
         RoomName = "";
         FrameReplay.Ins.OnDisconnected();
         FrameIndex = ServerFrameIndex = 0;
         U3D.InsertSystemMsg("与服务器断开链接.");
         if (!MainMenuState.Exist)
         {
             U3D.GoBack();
         }
     }
     RoomId   = -1;
     RoomName = "";
 }
Пример #24
0
 void OnJoinRoom()
 {
     if (SelectRoomId != -1)
     {
         RoomInfo r = RoomMng.Ins.GetRoom(SelectRoomId);
         for (int i = 0; i < r.models.Count; i++)
         {
             ModelItem m = null;
             if (!GameStateMgr.Ins.gameStatus.IsModelInstalled((int)r.models[i], ref m))
             {
                 if (m == null)
                 {
                     m = DlcMng.Ins.GetModelMeta((int)r.models[i]);
                 }
                 U3D.PopupTip(string.Format("需要安装-模型{0}后方可进入房间", m == null ? r.models[i].ToString():m.Name));
                 return;
             }
         }
         TcpClientProxy.Ins.JoinRoom(SelectRoomId);
     }
 }
Пример #25
0
    void OnItemPickuped(GetItemMsg item)
    {
        MeteorUnit unit = U3D.GetUnit((int)item.playerId);

        if (item.type == (int)GetItemType.SceneItem)
        {
            SceneItemAgent sceneItem = U3D.GetSceneItem((int)item.instance);
            if (sceneItem != null)
            {
                sceneItem.OnNetPickuped(unit);
            }
        }
        else if (item.type == (int)GetItemType.PickupItem)
        {
            PickupItemAgent pickup = U3D.GetPickupItem((int)item.instance);
            if (pickup != null)
            {
                pickup.OnNetPickup(unit);
            }
        }
    }
Пример #26
0
 void OnEnterChapter()
 {
     if (select != null)
     {
         //普通关卡对待.
         Main.Ins.CombatData.Chapter = select;
         string tip = "";
         if (!Main.Ins.DlcMng.CheckDependence(Main.Ins.CombatData.Chapter, out tip))
         {
             Main.Ins.DialogStateManager.ChangeState(Main.Ins.DialogStateManager.LevelDialogState, false);
         }
         else
         {
             U3D.PopupTip("Dlc依赖\n" + tip);
         }
     }
     else
     {
         U3D.PopupTip("请先在设置-模组中安装资料片");
     }
 }
Пример #27
0
    public static MeteorUnit InitPlayer(LevelScriptBase script)
    {
        MonsterEx  mon       = SceneMng.InitPlayer(script);
        GameObject objPrefab = Resources.Load("MeteorUnit") as GameObject;
        GameObject ins       = GameObject.Instantiate(objPrefab, Vector3.zero, Quaternion.identity) as GameObject;
        MeteorUnit unit      = ins.GetComponent <MeteorUnit>();

        MeteorManager.Instance.LocalPlayer = unit;
        unit.Camp = EUnitCamp.EUC_FRIEND;//流星阵营
        unit.Init(mon.Model, mon);
        MeteorManager.Instance.OnGenerateUnit(unit);
        //LuaFunction onInit = ScriptMng.ins.GetFunc("OnInit");
        //LuaFunction OnStart = ScriptMng.ins.GetFunc("OnStart");
        //onInit.call(unit.InstanceId);
        unit.SetGround(false);
        unit.transform.position    = Global.GLevelItem.wayPoint.Count > mon.SpawnPoint ? Global.GLevelItem.wayPoint[mon.SpawnPoint].pos : GameObject.Find("StartPoint").transform.position;//等关卡脚本实现之后在设置单机出生点.PlayerEx.Instance.SpawnPoint
        unit.transform.eulerAngles = new Vector3(0, mon.SpawnDir, 0);
        //OnStart.call();
        U3D.InsertSystemMsg(unit.name + " 加入游戏");
        return(unit);
    }
Пример #28
0
 static void OnConnect(int result, string message)
 {
     //取得房间信息
     if (result == 1)
     {
         retryNum = 3;
         TcpClientProxy.UpdateGameServer();
         //TcpClientProxy.AutoLogin();//验证客户端的合法性
     }
     else
     {
         //链接失败,重置对战
         U3D.PopupTip(message);
         Main.Ins.NetWorkBattle.OnDisconnect();
         retryNum--;
         if (retryNum <= 0)
         {
             TcpClientProxy.Exit();//重试3次,等待切换服务器再激活链接服务器的定时器.
             retryNum = 3;
         }
     }
 }
Пример #29
0
 void Init()
 {
     heroImg       = Control("Image").GetComponent <Image>();
     heroImg.color = Color.white;
     heroIdx       = -1;
     OnNextHero();
     Control("Next").GetComponent <Button>().onClick.AddListener(() =>
     {
         OnNextHero();
         U3D.PlayBtnAudio();
     });
     Control("Prev").GetComponent <Button>().onClick.AddListener(() =>
     {
         OnPrevHero();
         U3D.PlayBtnAudio();
     });
     Control("Select").GetComponent <UIButtonExtended>().onClick.AddListener(() =>
     {
         OnSelectHero();
         U3D.PlayBtnAudio();
     });
 }
Пример #30
0
 public void SyncNetPlayer()
 {
     if (netPlayers != null)
     {
         for (int i = 0; i < netPlayers.players.Count; i++)
         {
             PlayerSync player = netPlayers.players[i];
             MeteorUnit unit   = U3D.GetUnit((int)player.playerId);
             if (unit == null)
             {
                 U3D.OnCreateNetPlayer(player);
             }
         }
     }
     if (WeaponSelectDialogState.Exist)
     {
         Main.Ins.DialogStateManager.ChangeState(null);
     }
     FightState.State.Open();
     FrameSyncServer.Ins.Resume();
     netPlayers = null;
 }