virtual protected void Init() { //加载并实例化当前窗口 _mono_object = MonoBehaviour.Instantiate(Resources.Load(_windowPath), Vector3.zero, Quaternion.identity) as GameObject; //这一句改变GameObject名字纯属强迫症,看着顺眼,可以无视 _mono_object.name = _windowPath.Substring(_windowPath.LastIndexOf("/") + 1); _mono = _mono_object.GetComponent<MonoBase>(); if (_mono != null) _mono.SetDepth(); }
public passObj getPlayerInfoFormationObj(int length) { passObj go = new passObj(); if (length == 3) { go.obj = MonoBase.Create3Dobj("TeamPrepare/PlayerInfo/TeamPreparePlayerInfoThreeLos").obj as GameObject; } else if (length == 4) { go.obj = MonoBase.Create3Dobj("TeamPrepare/PlayerInfo/TeamPreparePlayerInfoFourLos").obj as GameObject; } else if (length == 5) { go.obj = MonoBase.Create3Dobj("TeamPrepare/PlayerInfo/TeamPreparePlayerInfoFiveLos").obj as GameObject; } else { go.obj = MonoBase.Create3Dobj("TeamPrepare/PlayerInfo/TeamPreparePlayerInfoTenLos").obj as GameObject; } return(go); }
public passObj getPlayerBattleFormationObj(int length) { passObj go = new passObj(); if (length == 3) { go.obj = MonoBase.Create3Dobj("Formation/Player/FormationPlayerThreeLos").obj as GameObject; } else if (length == 4) { go.obj = MonoBase.Create3Dobj("Formation/Player/FormationPlayerFourLos").obj as GameObject; } else if (length == 5) { go.obj = MonoBase.Create3Dobj("Formation/Player/FormationPlayerFiveLos").obj as GameObject; } else { go.obj = MonoBase.Create3Dobj("Formation/Player/FormationPlayerTenLos").obj as GameObject; } return(go); }
/// <summary> /// 添加事件 /// </summary> /// <param name="eventCode">Event code.</param> /// <param name="mono">Mono.</param> public void Add(int eventCode, MonoBase mono) { List <MonoBase> list = null; //之前没有注册过 if (!dict.ContainsKey(eventCode)) { list = new List <MonoBase>(); list.Add(mono); dict.Add(eventCode, list); //Debug.Log(eventCode.ToString() + " : " + mono.name); return; } //之前注册过 list = dict[eventCode]; if (!list.Contains(mono)) //同一个id 不用绑定同一个mono 比如 Bind(0,1); 这样就不会重复绑定 { //如果是 Bind(0); Bind(1); 这样写就会把0 重复绑定(绑定两次就会 遍历两次list,两次list中都有0) list.Add(mono); } //Debug.Log(eventCode.ToString() + " : " + mono.name); }
public override void read(ErlKVMessage message) { string str = (message.getValue("msg") as ErlAtom).Value; if (str == "ok") { if (callback != null) { callback(); } } else if (str == "cd_limit") { UiManager.Instance.createMessageLintWindow(LanguageConfigManager.Instance.getLanguage("s0307")); if (callback != null) { callback(); } } else if (str == "no_mem" || str == "no_guild") { UiManager.Instance.createMessageLintWindow(LanguageConfigManager.Instance.getLanguage("Guild_82")); } else if (str == "offline") { UiManager.Instance.createMessageLintWindow(LanguageConfigManager.Instance.getLanguage("s0490")); } else if (str == "not_friend") { UiManager.Instance.createMessageLintWindow(LanguageConfigManager.Instance.getLanguage("s0492")); } else { MonoBase.print(GetType() + "error:" + str); } }
//解析ErlKVMessgae public bool parseKVMsg(ErlKVMessage message) { ErlType type = message.getValue("msg") as ErlType; if (type is ErlArray) { ErlArray array = type as ErlArray; int max = array.Value.Length; for (int i = 0; i < max; i++) { ErlArray array2 = array.Value [i] as ErlArray; int sid = StringKit.toInt(array2.Value [0].getValueString()); int num = StringKit.toInt(array2.Value [1].getValueString()); ExchangeManagerment.Instance.updateExchange(sid, num); } ExchangeManagerment.Instance.countCompleteNum(); return(true); } else { MonoBase.print(GetType() + "==" + type.getValueString()); } return(false); }
public override void read(ErlKVMessage message) { //初始化好友信息 if (sendType == TYPE_INIT) { if (parseKVMsgTypeInit(message) && callback != null) { callback(); } } //删除好友 else if (sendType == TYPE_DEL) { string str = (message.getValue("msg") as ErlAtom).Value; switch (str) { case "ok": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendDEL_ok")); if (callback != null) { callback(); } break; case "not_friend": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendDEL_not_friend")); break; case "uid_error": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendDEL_uid_error")); break; default: MonoBase.print(GetType() + "error:" + str); break; } } //申请好友 else if (sendType == TYPE_APPLY) { string str = (message.getValue("msg") as ErlAtom).Value; switch (str) { case "ok": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_ok")); break; case "uid_error": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_uid_error")); break; case "already_apply": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_already_apply")); break; case "already_friend": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_already_friend")); break; case "size_limit_1": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_size_limit")); break; case "size_limit_2": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_size_limit_other")); break; default: MonoBase.print(GetType() + "============error:" + str); break; } if (callback != null) { callback(); } } //处理好友申请 else if (sendType == TYPE_AGREE || sendType == TYPE_REFUSE) { string str = (message.getValue("msg") as ErlAtom).Value; switch (str) { case "ok": if (sendType == TYPE_AGREE) { FriendsManagerment.Instance.addFriend(newFriendInfo); FriendsManagerment.Instance.refuseFriendApply(newFriendInfo.getUid()); ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAGREE_ok")); } else if (sendType == TYPE_REFUSE) { FriendsManagerment.Instance.refuseFriendApply(refuseUid); } if (callback != null) { callback(); } break; case "uid_error": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_uid_error")); if (callback != null) { callback(); } break; case "size_limit_1": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_size_limit")); break; case "size_limit_2": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_size_limit_other")); FriendsManagerment.Instance.refuseFriendApply(refuseUid); if (callback != null) { callback(); } break; case "already_friend": // ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_already_friend")); FriendsManagerment.Instance.refuseFriendApply(refuseUid); if (callback != null) { callback(); } break; case "no_apply": // ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_no_apply")); FriendsManagerment.Instance.refuseFriendApply(refuseUid); if (callback != null) { callback(); } break; case "type_error": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_type_error")); break; default: MonoBase.print(GetType() + "============error:" + str); break; } } //获得推荐好友 else if (sendType == TYPE_RECOMMEND || sendType == TYPE_FIND) { ErlType msg = message.getValue("msg") as ErlType; if (msg is ErlArray) { ErlArray array = msg as ErlArray; if (array == null) { return; } FriendsManagerment.Instance.createRecommendFriends(array); if (callback != null) { callback(); } } else { string str = (message.getValue("msg") as ErlAtom).Value; switch (str) { case "target_error": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_type_error")); break; case "info_error": ShowMsg(LanguageConfigManager.Instance.getLanguage("FriendAPPLY_type_error")); break; case "no_find": ShowMsg(LanguageConfigManager.Instance.getLanguage("Friend_no_find")); break; default: MonoBase.print(GetType() + "============error:" + str); break; } } } }
public EventNode(MonoBase _data) { data = _data; next = null; }
/// <summary> /// 将脚本添加到UIManager的消息响应链中 /// </summary> /// <param name="mono">脚本</param> /// <param name="msgs">脚本要监听的消息</param> public void RegisterSelfMsg(MonoBase mono, params ushort[] msgs) { NPCManager.Instance.RegisterMultMsg(mono, msgs); }
public EventNode(MonoBase tempMono) { this.data = tempMono; this.NextNode = null; }
public void RegistSelf(MonoBase mono, params ushort[] msgs) { AssetManager.instance.RegisMsg(mono, msgs); }
protected override void AttackTarget(UnitBase from, UnitBase target, bool canFightBack) { MonoBase.Get().GetMono().StartCoroutine(attackTarget(from, target, canFightBack)); }
public EventNode(MonoBase data) { this.data = data; this.next = null; }
//通讯接收 public void usePropOK(string str) { MonoBase.print("=usePropOK:" + str); }
public void setMonoChild(MonoBase tmpChild) { monoChild = tmpChild; }
public StateMachine(MonoBase owner, string initialState) { this.owner = owner; this.initialState = initialState; }
private void OnDestroy() { MonoBase.Get().GetMono().RemoveUpdateListener(CheckFocus); UnloadGameLogic(); }
public EventNode next; // 指向下一个节点 public EventNode(MonoBase tempMono) { this.mono = tempMono; next = null; }
public EventNode(MonoBase tmpMono) { this.data = tmpMono; this.next = null; }
/// <summary> /// 异步加载资源 /// </summary> /// <typeparam name="T">资源类型</typeparam> /// <param name="name">资源路径</param> /// <param name="callback">回调委托方法</param> public void LoadAsync <T>(string name, UnityAction <T> callback, bool instatiate = true) where T : Object { //开启异步加载协程 MonoBase.Get().GetMono().StartCoroutine(LoadAsyncCoroutine <T>(name, callback, instatiate)); }
public void RegisterSelf(MonoBase mono, params ushort[] msgs) { UIManager.Instance.RegisterMsg(mono, msgs); }
public override void read(ErlKVMessage message) { base.read(message); if (sendType == TYPE_INFO) { ErlType msg = message.getValue("msg") as ErlType; if (msg is ErlArray) { ErlArray array = msg as ErlArray; if (array == null) { return; } List <ChapterAwardServerSample> list = new List <ChapterAwardServerSample>(); for (int i = 0; i < array.Value.Length; i++) { ChapterAwardServerSample info = new ChapterAwardServerSample(); info.chapterSid = StringKit.toInt(((array.Value [i] as ErlArray).Value[0] as ErlType).getValueString()); ErlArray one = (array.Value [i] as ErlArray).Value[1] as ErlArray; info.awardSids = new int[one.Value.Length]; for (int j = 0; j < one.Value.Length; j++) { info.awardSids[j] = StringKit.toInt(one.Value [j].getValueString()); } list.Add(info); } FuBenManagerment.Instance.getChapterAwardSeverSampleBySid(list); } else { MonoBase.print(GetType() + "error:" + msg); } if (callback != null) { callback(); } callback = null; } else if (sendType == TYPE_GET) { string str = (message.getValue("msg") as ErlAtom).Value; switch (str) { case "ok": //UiManager.Instance.createMessageLintWindow(LanguageConfigManager.Instance.getLanguage("s0120")); ChapterAwardServerSample item = new ChapterAwardServerSample(); item.chapterSid = chapterSid; item.awardSids = new int[1] { awardSid }; FuBenManagerment.Instance.addChapterAwardSeverSample(item); if (callback != null) { callback(); } chapterSid = 0; awardSid = 0; callback = null; break; } } }
public void RegistSelf(MonoBase mono, params ushort[] msgs) { TabToyManager.Instance.RegistMsg(mono, msgs); }
public override void read(ErlKVMessage message) { base.read(message); string str = (message.getValue("type") as ErlAtom).Value; ErlType msg = message.getValue("value") as ErlType; ErlArray array = msg as ErlArray; GameObject win = GameObject.Find("/NGUI_manager/GameCamera/UIScaleRoot/FriendsWindow"); GameObject pvpWin = GameObject.Find("/NGUI_manager/GameCamera/UIScaleRoot/PvpPlayerWindow"); switch (str) { //别人申请你 case "apply": if (FriendsManagerment.Instance == null) { return; } FriendsManagerment.Instance.addRefuseFriend(array); GameObject mainWin = GameObject.Find("/NGUI_manager/GameCamera/UIScaleRoot/MainWindow"); if (win != null) { if ((win.GetComponent <FriendsWindow> ()).getTapType() == 1) { (win.GetComponent <FriendsWindow> ()).content2.reLoad(1); } else { (win.GetComponent <FriendsWindow> ()).showNewApply(); } } //新改版后没有实际意义 // else if (pvpWin != null) // (pvpWin.GetComponent<PvpPlayerWindow>()).initCallBack(null); else if (mainWin != null) { (mainWin.GetComponent <MainWindow>()).showFriendNum(); } break; //别人同意你的申请 case "agree": if (FriendsManagerment.Instance == null) { return; } FriendsManagerment.Instance.addFriend(array, true); if (win != null) { (win.GetComponent <FriendsWindow> ()).initWin(0); } //新改版后没有实际意义 // else if (pvpWin != null) // (pvpWin.GetComponent<PvpPlayerWindow>()).initCallBack(null); break; //你自动同意增加好友 case "agree_1": if (FriendsManagerment.Instance == null) { return; } FriendsManagerment.Instance.addFriend(array, false); if (win != null) { (win.GetComponent <FriendsWindow> ()).initWin(0); } //新改版后没有实际意义 // else if (pvpWin != null) // (pvpWin.GetComponent<PvpPlayerWindow>()).initCallBack(null); break; //别人解除和你的好友关系 case "delete": if (FriendsManagerment.Instance == null) { return; } FriendsManagerment.Instance.deleteFriend(array); if (win != null) { (win.GetComponent <FriendsWindow> ()).initWin(0); } //新改版后没有实际意义 // else if (pvpWin != null) // (pvpWin.GetComponent<PvpPlayerWindow>()).initCallBack(null); break; case "update": FriendsManagerment.Instance.updateFriend(array); break; default: MonoBase.print(GetType() + "==error:" + str); break; } }
/// <summary> /// 将脚本从UIManager的消息链中移除 /// </summary> /// <param name="mono">脚本</param> /// <param name="msgs">脚本监听的消息</param> public void RemoveSelfMsg(MonoBase mono, params ushort[] msgs) { AssetManager.Instance.RemoveMultMsg(mono, msgs); }
public void RegistSelf(MonoBase mono, params ushort[] msgs) { AssetBundleManager.Instance.RegistMsg(mono, msgs); }
public void LoadAsync(GameObject gameObject, UnityAction <GameObject> callback) { //开启异步加载协程 MonoBase.Get().GetMono().StartCoroutine(LoadAsyncCoroutine(gameObject, callback)); }
//创建战斗用的角色数据实例,列表管理在battleManager public CharacterData CreateBattleCharacterData(TeamInfoPlayer playerData, BattleTeamManager parentTeam, int battleType) { CharacterData _data = new CharacterData(); _data.serverID = playerData.id; _data.storeID = playerData.uid; _data.TeamPosIndex = playerData.embattle; //临时用 _data.server_hp = playerData.hp; _data.fixedServer_hp = playerData.hp; _data.server_max_hp = playerData.maxHp; _data.parentTeam = parentTeam; _data.orgScale = Vector3.one; _data.camp = playerData.camp; _data.EvoLevel = playerData.evoLevel; //是否是npc if (playerData.master == BattleReportService.NPC) { _data.isNPC = true; } else { _data.isNPC = false; } if (playerData.camp == TeamInfo.OWN_CAMP) { if (playerData.isGuardianForce) { // if (BattleManager.battleData.isArenaFinal || // BattleManager.battleData.isArenaMass || // BattleManager.battleData.isGuide || // BattleManager.battleData.isLadders || // BattleManager.battleData.isGuildBoss|| // BattleManager.battleData.isPvP|| // BattleManager.battleData.isMineralFightRecord) //公会boss在选择队伍的时候保存了一次活动队伍,看需求可能不能保存 _data.role = CardManagerment.Instance.createCard(playerData.sid); // else // _data.role = StorageManagerment.Instance.getBeast (ArmyManager.Instance.getActiveArmy ().beastid); } else { if (_data.isNPC) { //npc _data.orgScale = BattleManager.SACLEOFNPC; _data.role = CardManagerment.Instance.createCard("", playerData.sid, 0, 0); } else { //人 if (battleType == BattleType.BATTLE_TEN) { //十人战大小不同 _data.orgScale = BattleManager.SACLEOF10V10; if (BattleManager.battleData.isArenaFinal || BattleManager.battleData.isGuide || BattleManager.battleData.isLadders || BattleManager.battleData.isGodsWarGroupFight) { //_data.role = CardManagerment.Instance.createCard ("", playerData.sid, 0, 0); _data.role = CardManagerment.Instance.createCard(playerData.sid, playerData.surLevel); } else { //bugfix 竞技场固定用3 int armyID; if (BattleManager.battleData.isArenaMass || BattleManager.battleData.isArenaFinal || BattleManager.battleData.isLadders || BattleManager.battleData.isGodsWarGroupFight) { armyID = ArmyManager.PVP_TEAMID; } else if (BattleManager.battleData.isGuildFight) { armyID = ArmyManager.PVP_GUILD; } else { armyID = ArmyManager.Instance.getActiveArmy().armyid; } //十人战本方卡片获取方式不一样 站位 主力固定1 2 3 4 5,替补固定11 12 13 14 15 if (_data.TeamPosIndex < 6) { string id; if (BattleManager.battleData.isOneOnOneBossFight) { id = playerData.uid; } else { id = ArmyManager.Instance.getArmy(armyID).players [_data.TeamPosIndex - 1]; } _data.role = StorageManagerment.Instance.getRole(id); } else { string id; if (BattleManager.battleData.isOneOnOneBossFight) { id = playerData.uid; } else { id = ArmyManager.Instance.getArmy(armyID).alternate [_data.TeamPosIndex - 11]; } _data.role = StorageManagerment.Instance.getRole(id); } } } else { if (BattleManager.battleData.playerFormationID == 1) { _data.orgScale = BattleManager.SACLEOF3V3; } else if (BattleManager.battleData.playerFormationID == 2) { //todo 4人阵放大不 } if (BattleManager.battleData.isArenaFinal || BattleManager.battleData.isGuide || BattleManager.battleData.isLadders || BattleManager.battleData.isMineralFightRecord || BattleManager.battleData.isGodsWarFinal || BattleManager.battleData.isGodsWarGroupFight) { //_data.role = CardManagerment.Instance.createCard ("", playerData.sid, 0, 0); _data.role = CardManagerment.Instance.createCard(playerData.sid, playerData.surLevel); } else if (BattleManager.battleData.isOneOnOneBossFight) //恶魔挑战(只有一个人)很危险的操作 { _data.role = StorageManagerment.Instance.getRole(playerData.uid); //return _data; } else { _data.role = StorageManagerment.Instance.getRole(_data.storeID); } } } } } else { //敌人 //todo pvp单独处理,下面是pve的情况 if (playerData.isGuardianForce) { _data.role = CardManagerment.Instance.createCard(playerData.sid); } else { if (BattleManager.battleData.battleType == BattleType.BATTLE_TEN) { //十人战大小不同 _data.orgScale = BattleManager.SACLEOF10V10; } //_data.role = CardManagerment.Instance.createCard ("", playerData.sid, 0, 0); _data.role = CardManagerment.Instance.createCard(playerData.sid, playerData.surLevel); } } if (playerData.isGuardianForce) { if (playerData.camp == TeamInfo.OWN_CAMP) { _data.orgPosition = new Vector3(0, 0, -3); } else { _data.orgPosition = new Vector3(0, 0, 3); } } else { if (_data.isNPC) { _data.orgPosition = BattleManager.Instance.npcPoint.FindChild(_data.TeamPosIndex.ToString()).position; } else if (_data.isBoss) { _data.orgPosition = parentTeam.TeamHitPoint.position; } else { //如果是人 _data.orgPosition = parentTeam.formation.getPosition(_data.TeamPosIndex); } if (_data.role != null) { _data.isBoss = _data.role.isBoss(); } } if (_data.role == null) { MonoBase.print("role is null sid=" + playerData.sid); return(null); } return(_data); }
public void UnRegistSelf(MonoBase mono, params ushort[] msgs) { NetManager.Instance.UnRegistMsg(mono, msgs); }
/// <summary> /// 作用单位设置后事件 /// </summary> virtual protected void afterTargetSet() { MonoBase.Get().GetMono().RunDelayTask(() => { OnNextRound(null); }, 0.25f); }
public void RegistSelf(MonoBase mono, params ushort[] msgs) { CharactorMnanger.Instance.RegistMsgs(mono, msgs); }
//解析ErlKVMessgae public bool parseKVMsg(ErlKVMessage message) { //ErlType type = message.getValue ("msg") as ErlType; //if (type is ErlArray) { // ErlArray array = type as ErlArray; // int total = StringKit.toInt (array.Value[0].getValueString ()); // ErlArray AlreadyGet = array.Value[1] as ErlArray; // // 当前已经领取的奖励 // int[] receivedAward = new int[AlreadyGet.Value.Length]; // for (int i=0; i < receivedAward.Length; i++) { // receivedAward[i] = StringKit.toInt (AlreadyGet.Value[i].getValueString ()); // } // TotalLoginManagerment.Instance.update (total, receivedAward); // return true; //} //else { // MonoBase.print (GetType () + "=============" + type.getValueString ()); //} //return false; ErlType type = message.getValue("msg") as ErlType; if (type is ErlArray) { ErlArray stateArray = type as ErlArray; string state = stateArray.Value[0].getValueString(); if (state == "ok") { ErlArray array = stateArray.Value[1] as ErlArray; ErlType awardType = array.Value[0] as ErlType; if (awardType is ErlInt || awardType is ErlByte) //老天天把后台数据更新到前台来 { TotalLoginManagerment.Instance.NeweverydayState = false; int total = StringKit.toInt(array.Value[0].getValueString()); ErlArray AlreadyGet = array.Value[1] as ErlArray; int[] receivedAward = new int[AlreadyGet.Value.Length]; for (int i = 0; i < receivedAward.Length; i++) { receivedAward[i] = StringKit.toInt(AlreadyGet.Value[i].getValueString()); } TotalLoginManagerment.Instance.update(total, receivedAward); } else if (awardType is ErlArray) //新天天送把后台数据更新到前台来(星期几登陆过,那个sid被领取过) { TotalLoginManagerment.Instance.NeweverydayState = true; ErlArray loginWeek = array.Value[0] as ErlArray; ErlArray awardWeek = array.Value[1] as ErlArray; int total = StringKit.toInt(array.Value[2].getValueString()); TotalLoginManagerment.Instance.updateNewdayLoginDate(loginWeek); //更新那些星期登陆过 TotalLoginManagerment.Instance.updateNewDayLoginAward(awardWeek); //更新那些星期的奖励领取过了 TotalLoginManagerment.Instance.update(total, new int[0]); } } else if (state == "close") { TotalLoginManagerment.Instance.EverydayState = false; TotalLoginManagerment.Instance.NeweverydayState = false; } return(true); } else { MonoBase.print(GetType() + "==" + type.getValueString()); } return(false); }