Beispiel #1
0
        IEnumerator AcceptJoinRequest(string line, int id, int[] newArray, Action callBack)
        {
            LoadingOverlays[2].SetActive(true);
            WWWForm wf = new WWWForm();

            wf.AddField("type", 7);
            wf.AddField("hash", bl_DataBase.Instance.GetUserToken());
            wf.AddField("clanID", ClanInfo.ID);
            wf.AddField("userID", id);
            wf.AddField("settings", line);

            using (UnityWebRequest w = UnityWebRequest.Post(bl_LoginProDataBase.Instance.GetUrl(bl_LoginProDataBase.URLType.Clans), wf))
            {
                yield return(w.SendWebRequest());

                if (!w.isNetworkError)
                {
                    string t = w.downloadHandler.text;
                    if (t.Contains("done"))
                    {
                        ClanInfo.ClanJoinRequests.Clear();
                        ClanInfo.ClanJoinRequests.AddRange(newArray);
                        bl_MyClan mc = FindObjectOfType <bl_MyClan>();
                        if (mc != null)
                        {
                            mc.Refresh();
                        }
                        callBack.Invoke();
                    }
                    else
                    {
                        Debug.Log(t);
                    }
                }
                else
                {
                    Debug.LogError(w.error);
                }
            }
            LoadingOverlays[2].SetActive(false);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <param name="mc"></param>
        public void Set(bl_ClanInfo.ClanMember info, bl_MyClan mc)
        {
            MyClan        = mc;
            MemberInfo    = info;
            NameText.text = MemberInfo.GetNameWithRole();
#if CLANS
            var            localUser = bl_DataBase.Instance.LocalUser;
            ClanMemberRole pr        = localUser.Clan.PlayerRole();
            if (pr != ClanMemberRole.Member)
            {
                int ph = (int)pr;
                int uh = (int)MemberInfo.Role;
                if (ph > uh)
                {
                    KickButton.SetActive(MemberInfo.ID != localUser.ID); //don't allow kick ourselves
                    DesendButton.SetActive(uh > 0);
                    if ((ph - uh) >= 2)                                  //parent ranks can't accent others just one above him.
                    {
                        AscendButton.SetActive(true);
                    }
                }
            }
#endif
        }