Example #1
0
 public void SimpleClear()
 {
     this._config      = (PlayerConfig)null;
     this._titles      = (PlayerTitles)null;
     this._bonus       = (PlayerBonus)null;
     this._event       = (PlayerEvent)null;
     this._connection  = (LoginClient)null;
     this._inventory   = new PlayerInventory();
     this.FriendSystem = new FriendSystem();
     this._clanPlayers = new List <Account>();
     this._equip       = new PlayerEquipedItems();
     this._mission     = new PlayerMissions();
     this._status      = new AccountStatus();
 }
Example #2
0
    private void OnFriendBtn(ButtonScript obj, object args, int param1, int param2)
    {
        int fMax = 0;

        GlobalValue.Get(Constant.C_FriendMax, out fMax);
        if (FriendSystem.Instance().friends_.Count >= fMax)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("haoyoumax"));
            return;
        }

        MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("addfriend").Replace("{n}", PlayerInfo.instName_), () => {
            NetConnection.Instance.addFriend(PlayerInfo.instId_);
        });
    }
Example #3
0
 private void OnAddBlackList(ButtonScript obj, COM_ContactInfo info)
 {
     if (info == null)
     {
         return;
     }
     if (FriendSystem.Instance().GetBlack(info.instId_) != null)
     {
         MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("alreadyhaveback"), null, true);
         return;
     }
     MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("addback").Replace("{n}", info.name_), () => {
         NetConnection.Instance.addBlacklist(info.instId_);
     });
 }
Example #4
0
 public static void getFriendlyAccounts(FriendSystem system)
 {
     if (system == null || system._friends.Count == 0)
     {
         return;
     }
     try
     {
         using (NpgsqlConnection connection = SQLjec.getInstance().conn())
         {
             NpgsqlCommand command = connection.CreateCommand();
             connection.Open();
             string        loaded     = "";
             List <string> parameters = new List <string>();
             for (int idx = 0; idx < system._friends.Count; idx++)
             {
                 Friend friend = system._friends[idx];
                 string param  = "@valor" + idx;
                 command.Parameters.AddWithValue(param, friend.player_id);
                 parameters.Add(param);
             }
             loaded = string.Join(",", parameters.ToArray());
             command.CommandText = "SELECT player_name,player_id,rank,online,status FROM contas WHERE player_id in (" + loaded + ") ORDER BY player_id";
             NpgsqlDataReader data = command.ExecuteReader();
             while (data.Read())
             {
                 Friend friend = system.GetFriend(data.GetInt64(1));
                 if (friend != null)
                 {
                     friend.player.player_name = data.GetString(0);
                     friend.player._rank       = data.GetInt32(2);
                     friend.player._isOnline   = data.GetBoolean(3);
                     friend.player._status.SetData((uint)data.GetInt64(4), friend.player_id);
                 }
             }
             command.Dispose();
             data.Dispose();
             data.Close();
             connection.Dispose();
             connection.Close();
         }
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[AccountManager.FriendlyAccounts] Erro fatal!");
     }
 }
Example #5
0
    public override void Destroyobj()
    {
        hasDestroy_ = true;
        TeamSystem.OnChangejoinL  -= ShowUIPanel;
        TeamSystem.OnExitIteam    -= ExitIteamOk;
        TeamSystem.OnCreateTeam   -= CreateTeamOk;
        TeamSystem.OnChangeTeam   -= ChangeTeamOk;
        TeamSystem.OnUpdateTeamMB -= UpdateTeamMBOk;
        TeamSystem.OnLeaderChange -= changeLeaderOk;
        TeamSystem.OnDelMenber    -= DeTeamMunber;
        FriendSystem.Instance().UpdateFriend -= OnUpdataFriendList;
        TeamSystem.OnUpdateMemStateUI -= UpdatememberState;
        //UpdateMemberPositionUIOk = null;

        //AssetInfoMgr.Instance.DecRefCount(GlobalInstanceFunction.Instance.GetAssetsName((int)UIASSETS_ID.UIASSETS_TeamPanel, AssetLoader.EAssetType.ASSET_UI), true);
    }
Example #6
0
    void OnRecommendEvent(int id)
    {
        if (_findFriendCellList.Count > 0)
        {
            foreach (GameObject i in _findFriendCellList)
            {
                recomGrid.RemoveChild(i.transform);
                i.gameObject.transform.parent = null;
                i.gameObject.SetActive(false);
                _findFriendCellPool.Add(i);
            }
            _findFriendCellList.Clear();
        }
        COM_ContactInfo[] rcmfriends = FriendSystem.Instance().RecommendFriends;
        foreach (COM_ContactInfo req in rcmfriends)
        {
            GameObject objCell = null;
            if (_findFriendCellPool.Count > 0)
            {
                objCell = _findFriendCellPool[0];
                //objCell.SetActive(true);
                FriendRecommendCell cellUI = objCell.GetComponent <FriendRecommendCell>();
                _findFriendCellPool.Remove(objCell);
            }
            else
            {
                objCell = Object.Instantiate(recomCell.gameObject) as GameObject;
            }

            if (objCell != null)
            {
                FriendRecommendCell cellUI1 = objCell.GetComponent <FriendRecommendCell>();
                cellUI1.ContactInfo = req;
                cellUI1.level_.text = req.level_.ToString();
                //cellUI1.icon.spriteName = req
                //recomGrid.AddChild(objCell.transform);
                objCell.transform.parent = recomGrid.transform;
                objCell.SetActive(true);
                cellUI1.callBack             = OnAddFriendList;
                objCell.transform.localScale = Vector3.one;
                _findFriendCellList.Add(objCell);
            }
        }
        recomGrid.Reposition();
    }
Example #7
0
 private void OnClickJHY(ButtonScript obj, object args, int param1, int param2)
 {
     if (FriendSystem.Instance().IsmyFriend((int)SimplePInst.instId_))
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("AlreadyUrFirend"));
     }
     else
     {
         int fMax = 0;
         GlobalValue.Get(Constant.C_FriendMax, out fMax);
         if (FriendSystem.Instance().friends_.Count >= fMax)
         {
             PopText.Instance.Show(LanguageManager.instance.GetValue("haoyoumax"));
             return;
         }
         NetConnection.Instance.addFriend(SimplePInst.instId_);
     }
 }
Example #8
0
 void OnClickHy(ButtonScript obj, object args, int param1, int param2)
 {
     if (FriendSystem.Instance().IsmyFriend(uId))
     {
         PopText.Instance.Show(LanguageManager.instance.GetValue("alreadyhave"));
     }
     else
     {
         int fMax = 0;
         GlobalValue.Get(Constant.C_FriendMax, out fMax);
         if (FriendSystem.Instance().friends_.Count >= fMax)
         {
             PopText.Instance.Show(LanguageManager.instance.GetValue("haoyoumax"));
             return;
         }
         NetConnection.Instance.addFriend((uint)uId);
     }
     gameObject.SetActive(false);
 }
Example #9
0
    void OnClickHy(ButtonScript obj, object args, int param1, int param2)
    {
        COM_SimplePlayerInst _player = TeamSystem.GetTeamMemberByInsId(param1);

        if (FriendSystem.Instance().IsmyFriend((int)_player.instId_))
        {
            LanguageManager.instance.GetValue("alreadyhave");
        }
        else
        {
            int fMax = 0;
            GlobalValue.Get(Constant.C_FriendMax, out fMax);
            if (FriendSystem.Instance().friends_.Count >= fMax)
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("haoyoumax"));
                return;
            }
            NetConnection.Instance.addFriend(_player.instId_);
        }
    }
Example #10
0
        private static void FTell_OnCommand(CommandEventArgs e)
        {
            string args       = e.ArgString;
            Mobile from       = e.Mobile;
            int    spaceindex = args.IndexOf(' ');

            if (spaceindex != -1)
            {
                string name = args.Substring(0, spaceindex);
                string text = args.Substring(spaceindex + 1);

                if (name.Length < 2)
                {
                    from.SendMessage(133, "That name is too short. You need to specify at least 2 characters.");
                    return;
                }

                name = name.Replace('_', ' ');

                ArrayList friends = FriendSystem.GetFriendList(from).MutualFriends;
                int       sentto  = 0;
                foreach (Mobile friend in friends)
                {
                    string friendname = friend.Name;
                    //if ( friend.Name.ToLower() == name.ToLower() && friend.NetState != null )
                    if (name.Length <= friendname.Length && name.ToLower() == friendname.Substring(0, name.Length).ToLower() && friend.NetState != null)
                    {
                        FriendSystem.Tell(from, friend, text);
                        sentto++;
                    }
                }
                if (sentto == 0)
                {
                    from.SendMessage(133, "No friend named {0} is online.", name);
                }
            }
            else
            {
                from.SendMessage(133, "Invalid format. Try something like \"[FTell My_Best_Friend Hello!\".");
            }
        }
Example #11
0
    private void OnFunBtn(GameObject obj, COM_ContactInfo info)
    {
        if (info == null)
        {
            return;
        }
        if (_selectFriendBtn != null)
        {
            _selectFriendBtn.GetComponent <UISprite> ().spriteName = "jn_jinlan";
        }
        _selectFriendBtn = obj;
        _selectFriendBtn.GetComponent <UISprite> ().spriteName = "jn_jinlanliang";
        _selectFriend = info;


        if (FriendSystem.Instance().offens_.Contains(_selectFriend) && !FriendSystem.Instance().friends_.Contains(_selectFriend))
        {
            funAddFriend.gameObject.SetActive(true);
        }
        else
        {
            funAddFriend.gameObject.SetActive(false);
        }

        funPane.gameObject.SetActive(true);

        if (TeamSystem.IsInTeam() && TeamSystem.IsTeamLeader())
        {
            ctlTeamBtn.gameObject.GetComponentInChildren <UILabel>().text = LanguageManager.instance.GetValue("yaoqingrudui");
        }
        else
        {
            if (TeamSystem.IsInTeam())
            {
                ctlTeamBtn.gameObject.GetComponentInChildren <UILabel>().text = LanguageManager.instance.GetValue("haoyoushenqingrudui");;
            }
        }

        funBtns.transform.position = new Vector3(funBtns.transform.position.x, obj.gameObject.transform.position.y, 0f);
    }
Example #12
0
 void Start()
 {
     //setdepth ();
     item.SetActive(false);
     btns.Add(HaoYouBtn);
     btns.Add(JiaZuBtn);
     btns.Add(FuJinBtn);
     UIManager.SetButtonEventHandler(HaoYouBtn.gameObject, EnumButtonEvent.OnClick, OnClicHaoY, 0, 0);
     UIManager.SetButtonEventHandler(FuJinBtn.gameObject, EnumButtonEvent.OnClick, OnClicHaoY, 2, 0);
     UIManager.SetButtonEventHandler(JiaZuBtn.gameObject, EnumButtonEvent.OnClick, OnClicHaoY, 1, 0);
     UIManager.SetButtonEventHandler(CloseBtn.gameObject, EnumButtonEvent.OnClick, OnClicClose, 0, 0);
     foreach (COM_ContactInfo cinfo in FriendSystem.Instance().friends_)
     {
         friendList.Add(cinfo);
     }
     foreach (Avatar op in Prebattle.Instance.otherAvatarContainer_.Values)
     {
         otherPlayer.Add(op);
     }
     TabsSelect(0);
     SwitchMembers(0);
 }
Example #13
0
    private void UpdateLatelyList()
    {
        foreach (GameObject o in _offCellList)
        {
            offGrid.RemoveChild(o.transform);
            //	o.transform.transform = null;
            GameObject.Destroy(o);
        }

        _offCellList.Clear();

        foreach (COM_ContactInfo f in FriendSystem.Instance().offens_)
        {
            GameObject obj = Object.Instantiate(friendCell.gameObject) as GameObject;
            obj.SetActive(true);

            FriendItem cellUI = obj.GetComponent <FriendItem>();
            cellUI.ContactInfo = f;

            if (FriendSystem.Instance().NoChatDict.ContainsKey(f.name_))
            {
                //cellUI.red.gameObject.SetActive(true);
                cellUI.GetComponent <UISprite>().MarkOn(UISprite.MarkAnthor.MA_RightTop, -20, -130);
            }
            else
            {
                cellUI.GetComponent <UISprite>().MarkOff();
                //cellUI.red.gameObject.SetActive(false);
            }
            cellUI.IsBlack(false);
            UIManager.SetButtonEventHandler(obj, EnumButtonEvent.OnClick, OnFriendCell, 0, 0);
            cellUI.callBack = OnFunBtn;
            offGrid.AddChild(obj.transform);
            _offCellList.Add(obj);
            obj.transform.localScale = Vector3.one;
        }
        offGrid.Reposition();
    }
Example #14
0
    private void OnCtlBlackBtn(ButtonScript obj, object args, int param1, int param2)
    {
        if (_selectFriend == null)
        {
            return;
        }
        if (FriendSystem.Instance().blacks_.Count >= 100)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("haoyoumax"));
            return;
        }
        if (FriendSystem.Instance().blacks_.Count >= 100)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("haoyoumax"));
            return;
        }
        MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("addback").Replace("{n}", _selectFriend.name_), () => {
            NetConnection.Instance.addBlacklist(_selectFriend.instId_);
        });


        funPane.gameObject.SetActive(false);
    }
 protected override void OnTarget(Mobile from, object targ)
 {
     if (!(targ is PlayerMobile))
     {
         from.SendMessage(133, "You need to target a player.");
     }
     else if ((Mobile)targ == from)
     {
         from.SendMessage(133, "You can't target yourself.");
     }
     else
     {
         if (FriendSystem.AddFriend(from, (Mobile)targ))
         {
             from.SendMessage(133, "You've added {0} to your friends. He/she will show on your friend list when he/she added you.", ((Mobile)targ).Name);
             ((Mobile)targ).SendMessage(133, "{0} added you to his/her friends. You can add him/her to by typing [FriendList.", from.Name);
         }
         else
         {
             from.SendMessage(133, "This player is already on your friends list");
         }
     }
     from.SendGump(new FriendListGump(from));
 }
Example #16
0
    void Start()
    {
        hasDestroy_ = false;
        NetConnection.Instance.requestFriendList();
        InitUIText();
        guideAnimator_ = gameObject.GetComponent <Animator>();
        RestMemberCellUI();
        UIManager.SetButtonEventHandler(CloseBtn.gameObject, EnumButtonEvent.OnClick, OnClickClose, 0, 0);
        UIManager.SetButtonEventHandler(cerateTeamBtn.gameObject, EnumButtonEvent.OnClick, OnClickCreate, 0, 0);
        UIManager.SetButtonEventHandler(BianjieBtn.gameObject, EnumButtonEvent.OnClick, OnClickBianjie, 0, 0);
        HidenMaxMenberSizeUI();
        if (!TeamSystem.IsInTeam())
        {
            GameManager.Instance.GetActorClone((ENTITY_ID)GamePlayer.Instance.Properties[(int)PropertyType.PT_AssetId], (ENTITY_ID)GamePlayer.Instance.WeaponAssetID, EntityType.ET_Player, AssetLoadSelfCallBack, new ParamData(GamePlayer.Instance.InstId, 0, (int)GamePlayer.Instance.Properties[(int)PropertyType.PT_AssetId]), "UI", GamePlayer.Instance.DressID);

            uint[] bemps = GamePlayer.Instance.GetEmployeesBattles((int)GamePlayer.Instance.CurEmployeesBattleGroup);
            for (int i = 0; i < bemps.Length; i++)
            {
                if (bemps[i] == 0)
                {
                    continue;
                }
                //index=i;
                Employee emp = GamePlayer.Instance.GetEmployeeById((int)bemps[i]);
                GameManager.Instance.GetActorClone((ENTITY_ID)GamePlayer.Instance.GetEmployeeById((int)bemps[i]).GetIprop(PropertyType.PT_AssetId), (ENTITY_ID)0, EntityType.ET_Emplyee, AssetLoadEmployeeCallBack, new ParamData((int)bemps[i], i, GamePlayer.Instance.GetEmployeeById((int)bemps[i]).GetIprop(PropertyType.PT_AssetId)), "UI");
            }
            datingObj.SetActive(true);
            mubiaoObj.SetActive(false);
            teamnameObj.SetActive(false);
            tuichuBtn.gameObject.SetActive(false);
        }
        else
        {
            ResTeamLeaderBtnState();
            tuichuBtn.gameObject.SetActive(true);
            datingObj.SetActive(false);
            teamCellsState();
            UIManager.SetButtonEventHandler(tuichuBtn.gameObject, EnumButtonEvent.OnClick, OnClickTuichu, 0, 0);
        }
        if (huobanBtn.gameObject.activeSelf)
        {
            UIManager.SetButtonEventHandler(huobanBtn.gameObject, EnumButtonEvent.OnClick, OnClickHuoban, 0, 0);
        }
        SceneLoaded();
        TeamSystem.OnChangejoinL  += ShowUIPanel;
        TeamSystem.OnExitIteam    += ExitIteamOk;
        TeamSystem.OnCreateTeam   += CreateTeamOk;
        TeamSystem.OnChangeTeam   += ChangeTeamOk;
        TeamSystem.OnUpdateTeamMB += UpdateTeamMBOk;
        TeamSystem.OnLeaderChange += changeLeaderOk;
        TeamSystem.OnDelMenber    += DeTeamMunber;
        FriendSystem.Instance().UpdateFriend += new UpdateFriendHandler(OnUpdataFriendList);
        TeamSystem.OnUpdateMemStateUI += UpdatememberState;
        //UpdateMemberPositionUIOk = openOrOffBtn;
        //UpdateUI ();
        //teamInfo_ = TeamSystem._MyTeamInfo;
        GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_MainTeamUI);

        // if guide index
        int idx = 0;

        GlobalValue.Get(Constant.C_TeamGuideStep1, out idx);
        if (!GuideManager.Instance.IsFinish(idx))
        {
            guideAnimator_.SetTrigger("Step1");
            CreateMask();
            GuideManager.Instance.SetFinish(idx);
        }
    }
Example #17
0
    void OnFriendChat(COM_ContactInfo contact, COM_Chat msg)
    {
        if (_selectFriend != null && contact.instId_ == _selectFriend.instId_)
        {
            /*GameObject obj = Object.Instantiate(chatCell.gameObject) as GameObject;
             * obj.SetActive(true);
             * FriendItem cellUI = obj.GetComponent<FriendItem>();
             * cellUI._chatInfo = msg;
             * if(msg.audio_ != null && msg.audio_.Length > 0)
             * {
             * //	obj.transform.Find ("info").GetComponent<UILabel> ().gameObject.SetActive(false);
             *      obj.transform.Find ("vButton").GetComponent<UIButton> ().gameObject.SetActive(true);
             * }
             * else
             * {
             *      obj.transform.Find ("vButton").GetComponent<UIButton> ().gameObject.SetActive(false);
             * }
             * //obj.transform.Find ("info").GetComponent<UILabel> ().text = msg.content_;
             *
             * //cellUI.SetInfoBack(msg.content_);
             * cellUI.ParseSymbol(msg.content_);
             *
             * HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData((int)contact.assetId_).assetsIocn_, obj.transform.Find ("icon").Find ("Sprite").GetComponent<UITexture>());
             * if(!_icons.Contains(EntityAssetsData.GetData((int)contact.assetId_).assetsIocn_))
             * {
             *      _icons.Add(EntityAssetsData.GetData((int)contact.assetId_).assetsIocn_);
             * }
             *
             * cellUI.name_.text = contact.name_;
             * //cellUI.level_.text = contact.level_.ToString ();
             * chatGrid.AddChild(obj.transform);
             * obj.transform.localScale = Vector3.one;
             */



            GameObject tf = null;
            tf = GameObject.Instantiate(_GridItem) as GameObject;
            cGrid.AddChild(tf.transform);
            tf.transform.localScale = Vector3.one;
            tf.gameObject.SetActive(true);
            ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
            COM_ChatInfo info = new COM_ChatInfo();
            Filt(ref msg.content_, 0, 1);
            info.content_    = msg.content_;
            info.ck_         = ChatKind.CK_Friend;
            info.playerName_ = contact.name_;
            info.assetId_    = (ushort)contact.assetId_;
            cmi.Info         = info;
            cmi._LChatKindBackground.gameObject.SetActive(false);
            cmi._RChatKindBackground.gameObject.SetActive(false);
            chatCellList.Add(tf);
        }
        else
        {
            foreach (var x in friendCellList)
            {
                if (x.GetComponent <FriendItem>().ContactInfo.instId_ == contact.instId_)
                {
                    //x.GetComponent<FriendItem>().red.gameObject.SetActive(true);
                    x.GetComponent <UISprite>().MarkOn();                   //UISprite.MarkAnthor.MA_RightTop,0,0);
                    break;
                }
            }
            foreach (COM_ContactInfo f in FriendSystem.Instance().offens_)
            {
                if (f.instId_ == contact.instId_)
                {
                    offTabBtn.GetComponentInChildren <UISprite>().MarkOn(UISprite.MarkAnthor.MA_RightTop, -10, -10);
                    break;
                }
            }
        }
    }
Example #18
0
 public void Dispose()
 {
     FriendSystem.Remove(this);
 }
Example #19
0
 private void Start()
 {
     Events.Emit("S_UNIT");
     FriendSystem.Register(this);
 }
Example #20
0
    public void UpdataFriendList()
    {
        if (!leftPane.gameObject.activeSelf)
        {
            return;
        }
        foreach (GameObject o in friendCellList)
        {
            friendGrild.RemoveChild(o.transform);
            o.transform.parent = null;
            GameObject.Destroy(o);
        }
        friendCellList.Clear();

        int indx = friendGrild.GetIndex(friendBtn.transform);


        foreach (COM_ContactInfo f in FriendSystem.Instance().friends_)
        {
            if (f.isLine_)
            {
                GameObject obj = Object.Instantiate(friendCell.gameObject) as GameObject;
                obj.SetActive(true);
                FriendItem cellUI = obj.GetComponent <FriendItem>();
                cellUI.ContactInfo = f;
                if (FriendSystem.Instance().ChatDict.ContainsKey(f.name_))
                {
                    cellUI.red.gameObject.SetActive(true);
                }
                else
                {
                    cellUI.red.gameObject.SetActive(false);
                }
                cellUI.IsBlack(false);
                UIManager.SetButtonEventHandler(obj, EnumButtonEvent.OnClick, OnFriendCell, 0, 0);
                cellUI.callBack = OnFunBtn;
                friendGrild.AddChild(obj.transform, ++indx);

                friendCellList.Add(obj);
                obj.transform.localScale = Vector3.one;
            }
        }


        foreach (COM_ContactInfo f in FriendSystem.Instance().friends_)
        {
            if (!f.isLine_)
            {
                GameObject obj = Object.Instantiate(friendCell.gameObject) as GameObject;
                obj.SetActive(true);
                FriendItem cellUI = obj.GetComponent <FriendItem>();
                cellUI.ContactInfo = f;
                if (FriendSystem.Instance().ChatDict.ContainsKey(f.name_))
                {
                    cellUI.red.gameObject.SetActive(true);
                }
                else
                {
                    cellUI.red.gameObject.SetActive(false);
                }
                cellUI.IsBlack(false);
                UIManager.SetButtonEventHandler(obj, EnumButtonEvent.OnClick, OnFriendCell, 0, 0);
                cellUI.callBack = OnFunBtn;
                friendGrild.AddChild(obj.transform, ++indx);

                friendCellList.Add(obj);
                obj.transform.localScale = Vector3.one;
            }
        }
    }
Example #21
0
    private void UpdateChatList(COM_ContactInfo contact)
    {
        List <COM_Chat> strArr = FriendSystem.Instance().ChatCache(contact);

        for (int i = 0; i < chatCellList.Count; i++)
        {
            //chatGrid.RemoveChild(chatCellList[i].transform);
            cGrid.RemoveChild(chatCellList[i].transform);
            chatCellList[i].transform.parent = null;
            chatCellList[i].gameObject.SetActive(false);
            GameObject.Destroy(chatCellList[i]);
        }
        chatCellList.Clear();
        //	return;
        //}
        if (strArr != null && strArr.Count > 0)
        {
            for (int i = 0; i < strArr.Count; i++)
            {
                if (!strArr[i].isMe)
                {
                    GameObject tf = null;
                    tf = GameObject.Instantiate(_GridItem) as GameObject;
                    cGrid.AddChild(tf.transform);
                    tf.transform.localScale = Vector3.one;
                    tf.gameObject.SetActive(true);
                    ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
                    COM_ChatInfo info = new COM_ChatInfo();
                    Filt(ref strArr[i].content_, 0, 1);
                    info.content_    = strArr[i].content_;
                    info.ck_         = ChatKind.CK_Friend;
                    info.playerName_ = contact.name_;
                    info.assetId_    = (ushort)contact.assetId_;
                    cmi.Info         = info;
                    cmi._LChatKindBackground.gameObject.SetActive(false);
                    cmi._RChatKindBackground.gameObject.SetActive(false);
                    chatCellList.Add(tf);
                }
                else
                {
                    GameObject tf = null;
                    tf = GameObject.Instantiate(_GridItem) as GameObject;
                    cGrid.AddChild(tf.transform);
                    tf.transform.localScale = Vector3.one;
                    tf.gameObject.SetActive(true);
                    ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
                    COM_ChatInfo info = new COM_ChatInfo();
                    Filt(ref strArr[i].content_, 0, 1);
                    info.content_    = strArr[i].content_;
                    info.ck_         = ChatKind.CK_Friend;
                    info.playerName_ = GamePlayer.Instance.InstName;
                    info.assetId_    = (ushort)GamePlayer.Instance.GetIprop(PropertyType.PT_AssetId);
                    cmi.Info         = info;
                    cmi._LChatKindBackground.gameObject.SetActive(false);
                    cmi._RChatKindBackground.gameObject.SetActive(false);
                    chatCellList.Add(tf);
                }
            }
        }
        cGrid.Reposition();
        scrollBar.value = 1;
        //FriendSystem.Instance ().ChatDict.Remove(contact.name_);
    }
Example #22
0
    void Start()
    {
        UIManager.SetButtonEventHandler(close_.gameObject, EnumButtonEvent.OnClick, OnClose, 0, 0);
        UIManager.SetButtonEventHandler(closeFindBtn.gameObject, EnumButtonEvent.OnClick, OnCloseFind, 0, 0);

        UIManager.SetButtonEventHandler(blackBtn.gameObject, EnumButtonEvent.OnClick, OnInitBlack, 0, 0);
        UIManager.SetButtonEventHandler(addFriendBtn.gameObject, EnumButtonEvent.OnClick, OnAddFriend, 0, 0);
        UIManager.SetButtonEventHandler(addBlackBtn.gameObject, EnumButtonEvent.OnClick, OnAddBlack, 0, 0);
        UIManager.SetButtonEventHandler(funCloseBtn.gameObject, EnumButtonEvent.OnClick, OnCloseFun, 0, 0);
        UIManager.SetButtonEventHandler(findFriendName.gameObject, EnumButtonEvent.OnClick, OnfindFriend, 0, 0);
        UIManager.SetButtonEventHandler(findBlackBtn.gameObject, EnumButtonEvent.OnClick, OnFindBlack, 0, 0);
        UIManager.SetButtonEventHandler(sendChatBtn.gameObject, EnumButtonEvent.OnClick, OnSendChat, 0, 0);

        UIManager.SetButtonEventHandler(friendTabBtn.gameObject, EnumButtonEvent.OnClick, OnFriendTabBtn, 0, 0);
        UIManager.SetButtonEventHandler(offTabBtn.gameObject, EnumButtonEvent.OnClick, OnOffTabBtn, 0, 0);
        UIManager.SetButtonEventHandler(huanBtn.gameObject, EnumButtonEvent.OnClick, OnHuanBtn, 0, 0);
        UIManager.SetButtonEventHandler(funCloseBack.gameObject, EnumButtonEvent.OnClick, OnCloseFun, 0, 0);
        UIManager.SetButtonEventHandler(funAddFriend.gameObject, EnumButtonEvent.OnClick, OnAddFriendFun, 0, 0);
        UIManager.SetButtonEventHandler(faceBtn.gameObject, EnumButtonEvent.OnClick, OnfaceBtn, 0, 0);



        //选择好友操作按钮.
        UIManager.SetButtonEventHandler(ctlSendBtn.gameObject, EnumButtonEvent.OnClick, OnCtlSendBtn, 0, 0);
        UIManager.SetButtonEventHandler(ctlLookBtn.gameObject, EnumButtonEvent.OnClick, OnCtlLookBtn, 0, 0);
        UIManager.SetButtonEventHandler(ctlTeamBtn.gameObject, EnumButtonEvent.OnClick, OnCtlTeamBtn, 0, 0);

        UIManager.SetButtonEventHandler(ctlDelBtn.gameObject, EnumButtonEvent.OnClick, OnCtlDelBtn, 0, 0);
        UIManager.SetButtonEventHandler(ctlBlackBtn.gameObject, EnumButtonEvent.OnClick, OnCtlBlackBtn, 0, 0);

        UIEventListener.Get(_VoiceBtn.gameObject).onPress = OnPrassVoice;
        //事件.
        FriendSystem.Instance().UpdateFriend      += new UpdateFriendHandler(OnUpdataFriendList);
        FriendSystem.Instance().UpdateBlack       += new UpdateBlackHandler(OnUpdataBlackList);
        FriendSystem.Instance().UpdateOffen       += new UpdateOffenHandler(OnUpdateOffens);
        FriendSystem.Instance().FriendChat        += new FriendChatHandler(OnFriendChat);
        FriendSystem.Instance().FindFriendOkEvent += new RequestEventHandler <COM_ContactInfo> (FindFriendOk);
        FriendSystem.Instance().FindFriendFail    += new FindFriendFailHandler(FindFriendFail);
        FriendSystem.Instance().recommendEvent    += new RequestEventHandler <int> (OnRecommendEvent);
        FriendSystem.Instance().friendOnLineEvent += new RequestEventHandler <bool> (OnLineEvent);

        NetConnection.Instance.requestFriendList();
        ChartsSystem.QueryPlayerEventOk += OnQueryPlayer;

        GuideManager.Instance.RegistGuideAim(addFriendBtn.gameObject, GuideAimType.GAT_FriendAddBtn);
        OpenPanelAnimator.PlayOpenAnimation(this.panel, () => {
            friendGrild.AddChild(friendBtn.transform, 0);
            //friendBtn.transform.parent = friendGrild.transform;
            friendBtn.SetActive(true);
            friendBtn.transform.localScale = Vector3.one;
            UIManager.SetButtonEventHandler(friendBtn.gameObject, EnumButtonEvent.OnClick, OnClickFirend, 0, 0);
            friendGrild.AddChild(blackBtn.transform, 1);
            //blackBtn.transform.parent = friendGrild.transform;
            blackBtn.SetActive(true);
            blackBtn.transform.localScale = Vector3.one;
            UIManager.SetButtonEventHandler(blackBtn.gameObject, EnumButtonEvent.OnClick, OnInitBlack, 0, 0);

            //friendGrild.Reposition();

            friendTabBtn.isEnabled = false;
            //UpdataFriendList ();
            FriendSystem.Instance().isOpenFried = true;
            if (FriendSystem.Instance().offens_.Count > 0)
            {
                foreach (COM_ContactInfo f in FriendSystem.Instance().offens_)
                {
                    if (FriendSystem.Instance().NoChatDict.ContainsKey(f.name_))
                    {
                        //offTabBtn.GetComponentInChildren<UISprite>().MarkOff();
                        offTabBtn.GetComponentInChildren <UISprite>().MarkOn(UISprite.MarkAnthor.MA_RightTop, -10, -10);
                        break;
                    }
                }
            }

            GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_ClickMainFriend);
        });
        audioSO = gameObject.GetComponentInParent <AudioSource> ();
        InitFace();
        if (FriendSystem.Instance().friends_.Count <= 0)
        {
            selectChatLab.gameObject.SetActive(false);
        }
    }
Example #23
0
    void OnLineEvent(bool line)
    {
        if (string.IsNullOrEmpty(friendChatLab.text.Trim()))
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("bunengweikong"));
            return;
        }
        if (!line)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("frinedonline"));
            return;
        }

        else if (chat_com != null)
        {
            chat_com.ck_ = ChatKind.CK_Friend;
            Filt(ref chat_com.content_, 0, 1);
            NetConnection.Instance.sendChat(chat_com, _selectFriend.name_);
            if (chat_com.content_.Length > 30)
            {
                //PopText.Instance.Show(LanguageManager.instance.GetValue("chatLineMax"));
                //return;
            }

            //COM_Chat comC = new COM_Chat();
            chat_com.ck_      = ChatKind.CK_Friend;
            chat_com.content_ = friendChatLab.text;
            chat_com.isMe     = true;
            //	NetConnection.Instance.sendChat (comC,_selectFriend.name_);

            GameObject tf = null;
            tf = GameObject.Instantiate(_GridItem) as GameObject;
            cGrid.AddChild(tf.transform);
            tf.transform.localScale = Vector3.one;
            tf.gameObject.SetActive(true);
            ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
            COM_ChatInfo info = new COM_ChatInfo();            // (COM_ChatInfo)comC ;
            info.playerName_ = GamePlayer.Instance.InstName;

            info.content_ = friendChatLab.text;
            Filt(ref info.content_, 0, 1);
            info.ck_      = ChatKind.CK_Friend;
            info.assetId_ = (ushort)GamePlayer.Instance.GetIprop(PropertyType.PT_AssetId);
            cmi.Info      = info;
            cmi._LChatKindBackground.gameObject.SetActive(false);
            cmi._RChatKindBackground.gameObject.SetActive(false);
            chat_com = null;
            FriendSystem.Instance().addMyChat(_selectFriend.name_, chat_com);
            chatCellList.Add(tf);

            friendChatLab.text = "";
            chatInput.value    = "";
        }
        else
        {
            if (string.IsNullOrEmpty(friendChatLab.text.Trim()))
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("bunengweikong"));
                return;
            }
            if (friendChatLab.text.Length > 30)
            {
                //PopText.Instance.Show(LanguageManager.instance.GetValue("chatLineMax"));
                //return;
            }
            COM_Chat comC = new COM_Chat();
            comC.ck_      = ChatKind.CK_Friend;
            comC.content_ = friendChatLab.text;
            Filt(ref comC.content_, 0, 1);
            NetConnection.Instance.sendChat(comC, _selectFriend.name_);

            GameObject tf = null;
            tf = GameObject.Instantiate(_GridItem) as GameObject;
            cGrid.AddChild(tf.transform);
            tf.transform.localScale = Vector3.one;
            tf.gameObject.SetActive(true);
            ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
            COM_ChatInfo info = new COM_ChatInfo();
            info.playerName_ = GamePlayer.Instance.InstName;
            info.content_    = friendChatLab.text;
            Filt(ref info.content_, 0, 1);
            info.ck_      = ChatKind.CK_Friend;
            info.assetId_ = (ushort)GamePlayer.Instance.GetIprop(PropertyType.PT_AssetId);
            cmi.Info      = info;
            cmi._LChatKindBackground.gameObject.SetActive(false);
            cmi._RChatKindBackground.gameObject.SetActive(false);
            comC.isMe          = true;
            friendChatLab.text = "";
            chatInput.value    = "";
            FriendSystem.Instance().addMyChat(_selectFriend.name_, comC);
            chatCellList.Add(tf);
        }
        cGrid.Reposition();
        scrollBar.value = 1;
    }
Example #24
0
    void InitPlayerInfo()
    {
        nameLab.text  = _splayerInst.instName_;
        levelLab.text = _splayerInst.properties_[(int)PropertyType.PT_Level] + "";
        zhiyeb.text   = Profession.get((JobType)_splayerInst.properties_[(int)PropertyType.PT_Profession], (int)_splayerInst.properties_[(int)PropertyType.PT_ProfessionLevel]).jobName_;
        int      weapon        = GlobalInstanceFunction.Instance.WeaponID(_splayerInst);
        int      weaponAssetid = 0;
        ItemData wep           = ItemData.GetData(weapon);

        if (wep != null)
        {
            weaponAssetid = wep.weaponEntityId_;
        }
        GameManager.Instance.GetActorClone((ENTITY_ID)_splayerInst.properties_[(int)PropertyType.PT_AssetId], (ENTITY_ID)weaponAssetid, EntityType.ET_Player, AssetLoadCallBack, null, "UI", GlobalInstanceFunction.Instance.GetDressId(_splayerInst.equips_));
        float idd = _splayerInst.properties_ [(int)PropertyType.PT_AssetId];

        for (int i = 0; i < eql.Count; i++)
        {
            if (eql[i] != null)
            {
                eql[i].SetActive(false);

//				UITexture te = equips[i].GetComponent<UITexture>();
//				te.mainTexture = null;
            }
        }

        for (int i = 0; i < _splayerInst.equips_.Length; i++)
        {
            if (_splayerInst.equips_[i] != null)
            {
                HeroEquipCellUI hec = eql[_splayerInst.equips_[i].slot_].GetComponent <HeroEquipCellUI>();
                hec.Equip = _splayerInst.equips_[i];
//				UITexture te = equips[_splayerInst.equips_[i].slot_].GetComponent<UITexture>();
//				HeadIconLoader.Instance.LoadIcon (ItemData.GetData((int)_splayerInst.equips_[i].itemId_).icon_, te);
            }
            else
            {
                //equips[i].gameObject.SetActive(false);
            }
        }

        for (int i = 0; i < employes.Count; i++)
        {
            employes[i].gameObject.SetActive(false);
        }

        for (int i = 0; i < babeis.Count; i++)
        {
            babeis[i].gameObject.SetActive(false);
        }

        for (int i = 0; i < _splayerInst.battleEmps_.Length; i++)
        {           //nas =  =
            employes[i].gameObject.SetActive(true);

            employes[i].transform.Find("icon").GetComponent <UISprite>().spriteName = EmployessSystem.instance.GetQualityBack((int)_splayerInst.battleEmps_[i].quality_);
            employes[i].transform.Find("name").GetComponent <UILabel>().text        = _splayerInst.battleEmps_[i].instName_;
            UISprite sp = employes[i].transform.FindChild("icon").FindChild("zhiye").GetComponent <UISprite>();
            sp.spriteName = Profession.get((JobType)_splayerInst.battleEmps_[i].properties_[(int)PropertyType.PT_Profession], (int)_splayerInst.battleEmps_[i].properties_[(int)PropertyType.PT_ProfessionLevel]).jobtype_.ToString();
            //employes[i].transform.Find("pross").GetComponent<UILabel>().text =  LanguageManager.instance.GetValue(((JobType)_splayerInst.battleEmps_[i].properties_[(int)PropertyType.PT_Profession]).ToString());
            UITexture tex1 = employes[i].transform.Find("icon").Find("icon").GetComponent <UITexture>();
            HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData((int)_splayerInst.battleEmps_[i].properties_[(int)PropertyType.PT_AssetId]).assetsIocn_, tex1);
        }

        for (int i = 0; i < _splayerInst.babies1_.Length; i++)
        {
            babeis[i].gameObject.SetActive(true);
            UITexture tex = babeis[i].transform.FindChild("icon").GetComponent <UITexture>();
            HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData((int)_splayerInst.babies1_[i].properties_[(int)PropertyType.PT_AssetId]).assetsIocn_, tex);

            UITexture tex1 = babeis[i].transform.FindChild("zhongzuIocn").GetComponent <UITexture>();
            HeadIconLoader.Instance.LoadIcon(BabyData.GetData((int)_splayerInst.babies1_[i].properties_[(int)PropertyType.PT_TableId])._RaceIcon, tex1);
            babeis[i].transform.FindChild("Label").GetComponent <UILabel>().text = _splayerInst.babies1_[i].properties_[(int)PropertyType.PT_Level].ToString();
        }

        if (!GamePlayer.Instance.GetOpenSubSystemFlag(OpenSubSystemFlag.OSSF_Friend))
        {
            haoyouBtn.gameObject.SetActive(false);
        }

        if (_splayerInst.instId_ == GamePlayer.Instance.InstId)
        {
            haoyouBtn.gameObject.SetActive(false);
        }
        if (FriendSystem.Instance().IsmyFriend((int)_splayerInst.instId_))
        {
            haoyouBtn.gameObject.SetActive(false);
        }
    }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (from == null)
            {
                return;
            }

            int button = info.ButtonID;

            switch (button)
            {
            case 0:
                break;

            case 1:
                m_Mobile.SendGump(new FriendListGump(m_Mobile, m_Page - 1));
                break;

            case 2:
                m_Mobile.SendGump(new FriendListGump(m_Mobile, m_Page + 1));
                break;

            case 5:
            {
                m_Mobile.Target = new AddFriendTarget();
                m_Mobile.SendMessage(133, "Target somebody to make them your friend.");
                break;
            }

            case 9:
            {
                m_Mobile.SendMessage(133, "To send a message to a friend named Lolipop, type \"[FTell Lolipop Hello friend!\"");
                m_Mobile.SendMessage(133, "To write a player whom has spaces in his name, use _ instead of spaces as example: \"[FTell John_Adams I think you're cute!\".");
                m_Mobile.SendMessage(133, "You don't have to type your friend's whole name to send him a message. The first two letters of the name is enough.");
                m_Mobile.SendMessage(133, "You cannot send tells to a player unless he/she is on your list.");
                m_Mobile.SendGump(new FriendListGump(m_Mobile));
                break;
            }

            default:
            {
                ArrayList friends = FriendSystem.GetFriendList(m_Mobile).MutualFriends;
                int       f       = button - 10;
                if (f >= 100)
                {
                    f -= 100;
                    if (f < 0 || f >= friends.Count)
                    {
                        return;
                    }
                    Mobile friend = (Mobile)friends[f];
                    m_Mobile.SendMessage(133, "Enter a message to send {0}.", friend.Name);
                    m_Mobile.Prompt = new FriendTellPrompt(m_Mobile, friend);
                }
                else
                {
                    if (f < 0 || f >= friends.Count)
                    {
                        return;
                    }
                    FriendSystem.RemoveFriend(m_Mobile, (Mobile)friends[f]);
                    m_Mobile.SendGump(new FriendListGump(m_Mobile));
                }
                break;
            }
            }
        }
Example #26
0
 public void getFriendlyAccounts(FriendSystem system, bool isOnline)
 {
     if (system == null)
     {
         return;
     }
     if (system._friends.Count == 0)
     {
         return;
     }
     try
     {
         using (NpgsqlConnection npgsqlConnection = SQLjec.getInstance().conn())
         {
             NpgsqlCommand command    = npgsqlConnection.CreateCommand();
             List <string> stringList = new List <string>();
             for (int index = 0; index < system._friends.Count; ++index)
             {
                 Friend friend = system._friends[index];
                 if (friend.state > 0)
                 {
                     return;
                 }
                 string parameterName = "@valor" + (object)index;
                 command.Parameters.AddWithValue(parameterName, (object)friend.player_id);
                 stringList.Add(parameterName);
             }
             string str = string.Join(",", stringList.ToArray());
             if (str == "")
             {
                 return;
             }
             npgsqlConnection.Open();
             command.Parameters.AddWithValue("@on", (object)isOnline);
             command.CommandText = "SELECT player_name,player_id,rank,status FROM accounts WHERE player_id in (" + str + ") AND online=@on ORDER BY player_id";
             NpgsqlDataReader npgsqlDataReader = command.ExecuteReader();
             while (npgsqlDataReader.Read())
             {
                 Friend friend = system.GetFriend(npgsqlDataReader.GetInt64(1));
                 if (friend != null)
                 {
                     friend.player.player_name = npgsqlDataReader.GetString(0);
                     friend.player._rank       = npgsqlDataReader.GetInt32(2);
                     friend.player._isOnline   = isOnline;
                     friend.player._status.SetData((uint)npgsqlDataReader.GetInt64(3), friend.player_id);
                     if (isOnline && !this._contas.ContainsKey(friend.player_id))
                     {
                         friend.player.setOnlineStatus(false);
                         friend.player._status.ResetData(friend.player_id);
                     }
                 }
             }
             command.Dispose();
             npgsqlDataReader.Dispose();
             npgsqlDataReader.Close();
             npgsqlConnection.Dispose();
             npgsqlConnection.Close();
         }
     }
     catch (Exception ex)
     {
         Logger.error("Ocorreu um problema ao carregar (FriendAccounts2)!\r\n" + ex.ToString());
     }
 }