예제 #1
0
    void SetPlayerView(ref PlayerView view, UserInfo info)
    {
        NUserInfo userInfo = userPackage.GetUserInfo(info.Uid);

        view.name.text   = userInfo.name;
        view.level.text  = string.Format("Lv.{0}", userPackage.GetLevel(info.Contribution));
        view.bloodMax    = 20 + 2 * info.Health;
        view.blood.value = (float)info.Blood / (float)view.bloodMax;
    }
예제 #2
0
    void InitView()
    {
        long      userID = userPackage.GetSelectionUserID();
        NUserInfo info   = userPackage.GetUserInfo(userID);

        if (info == null)
        {
            return;
        }
        nameLabel.text         = info.name;
        contributionLabel.text = info.contribution.ToString();
        idLabel.text           = info.uID.ToString();
    }
예제 #3
0
    void ShowSelf()
    {
        nameLabel.text         = userPackage.GetGroupName();
        levelLabel.text        = string.Format("Lv.{0}", userPackage.GetManorLevel());
        contributionLabel.text = string.Format("实力:{0}", userPackage.GetTotalContribution());
        int count   = 0;
        var userMap = userPackage.GetUserInfoMap();

        foreach (var pair in userMap)
        {
            NUserInfo info = pair.Value;
            playerInofs[count].nameLabel.text = info.name;
        }
    }
예제 #4
0
 void ShowPlayerInfo(int index, NUserInfo info, NGroupInfo groupInfo)
 {
     if (index >= 4)
     {
         return;
     }
     userCells[index].nameLabel.text  = info.name;
     userCells[index].levelLabel.text = string.Format("Lv.{0}",
                                                      GlobalFunction.CalculatePlayerLevel(info.contribution)
                                                      );
     userCells[index].interestLabel.text = string.Format("分配比例:{0}%",
                                                         GlobalFunction.CalculateInterest(info.contribution, groupInfo.totalContribution, groupInfo.userList.Count) * 100
                                                         );
 }
예제 #5
0
    void ProcessPlayerInfo(InvadeResultInfo info, out string resStr)
    {
        NUserInfo userInfo = userPackage.GetUserInfo(info.Id);

        if (info.Blood <= 20)
        {
            resStr = string.Format("[960000]玩家{0}被僵尸重创,无法继续战斗![-]", userInfo.name);
        }
        else
        {
            resStr = string.Format("玩家{0}击杀了{1}只僵尸", userInfo.name, info.Num);
        }
        UpdatePlayerView(info.Id, info.Blood);
    }
예제 #6
0
    public void onCreateLinkingSuccess(string result)
    {
        Debug.Log("GamePotEventListener::onCreateLinkSuccess() - " + result);
        NUserInfo userInfo = JsonMapper.ToObject <NUserInfo>(result);

        if (cbCreateLinking != null)
        {
            cbCreateLinking(NCommon.ResultLinking.SUCCESS, userInfo);
            cbCreateLinking = null;
        }
        else
        {
            if (GamePotInterface != null)
            {
                GamePotInterface.onCreateLinkingSuccess(userInfo);
            }
        }
    }
예제 #7
0
    public void onLoginSuccess(string result)
    {
        Debug.Log("GamePotEventListener::onLoginSuccess-" + result);
        NUserInfo userInfo = JsonMapper.ToObject <NUserInfo>(result);

        if (cbLogin != null)
        {
            cbLogin(NCommon.ResultLogin.SUCCESS, userInfo);
            cbLogin = null;
        }
        else
        {
            if (GamePotInterface != null)
            {
                GamePotInterface.onLoginSuccess(userInfo);
            }
        }
    }
예제 #8
0
        public static void login(NCommon.LoginType loginType)
        {
#if UNITY_ANDROID
            {
                if (mGamePotClass != null)
                {
                    mGamePotClass.CallStatic("login", loginType.ToString());
                }
            }
#elif UNITY_EDITOR
            {
                GamePotEventListener listener = GamePotEventListener.s_instance;
                if (loginType == NCommon.LoginType.GUEST)
                {
                    Debug.Log("GamePot - UNITY EDITOR DUMMY CALLBACK login with GUEST. It does not communicate with server.");
                    // Temporary user info for UnityEditor Development mode
                    if (listener != null)
                    {
                        NUserInfo userInfo = new NUserInfo
                        {
                            memberid = "UE-" + SystemInfo.deviceUniqueIdentifier,
                            userid   = "UE-" + SystemInfo.deviceUniqueIdentifier,
                            name     = "UnityEditor",
                            token    = "UnityEditorTempToken"
                        };

                        GamePotSettings.MemberInfo = userInfo;
                        listener.onLoginSuccess(userInfo.ToJson());
                    }
                    else
                    {
                        Debug.LogError("GamePot UnityEditor listener is NULL");
                    }
                }
                else
                {
                    Debug.Log("GamePot - UNITY EDITOR DUMMY CALLBACK login cancelled");
                    listener.onLoginCancel();
                }
            }
#endif
        }
예제 #9
0
 public void InitCharacterSelect(bool init)
 {
     panelCreate.SetActive(false);
     panelSelect.SetActive(true);
     if (init)
     {
         foreach (var old in uiChars)
         {
             Destroy(old);
         }
         uiChars.Clear();
         NUserInfo user = Models.User.Instance.Info;
         MyTools.SetChildCount(uiCharList, user.Player.Characters == null ? 0 : user.Player.Characters.Count, (index, item) =>
         {
             SetCharacterItem(item, user.Player.Characters[index], index);
         });
         if (user.Player.Characters != null && user.Player.Characters.Count > 0)
         {
             SetCharacterItem(uiCharList.GetChild(0).gameObject, user.Player.Characters[0], 0);
         }
     }
 }
예제 #10
0
    public string ToJson()
    {
        JsonData data = new JsonData();

        data["type"]    = type;
        data["message"] = message;

        if (type.Equals("maintenance"))
        {
            if (url != null && !url.Equals("null"))
            {
                data["url"] = url;
            }
        }
        else if (type.Equals("needupdate"))
        {
            if (currentAppVersion != null && !currentAppVersion.Equals("null"))
            {
                data["currentAppVersion"] = currentAppVersion;
            }
            if (updateAppVersion != null && !updateAppVersion.Equals("null"))
            {
                data["updateAppVersion"] = updateAppVersion;
            }

            data["currentAppVersionCode"] = currentAppVersionCode;
            data["updateAppVersionCode"]  = updateAppVersionCode;
            data["isForce"] = isForce;

            NUserInfo nestedUserinfo = JsonMapper.ToObject <NUserInfo>(resultPayload);
            data["resultPayload"] = nestedUserinfo.ToJson();
        }

        Debug.Log("NAppStatus::ToJson() - " + data.ToJson());

        return(data.ToJson());
    }
예제 #11
0
 public void SetupUserInfo(NUserInfo info)
 {
     this.userInfo = info;
 }
예제 #12
0
    public void AddUserInfo(UserInfo info)
    {
        NUserInfo userInfo = new NUserInfo(info);

        userInfoMap[info.Uid] = userInfo;
    }
예제 #13
0
 public void onCreateLinkingSuccess(NUserInfo userInfo)
 {
     linkingStatusUpdate();
 }
예제 #14
0
 public void onLoginSuccess(NUserInfo userInfo)
 {
 }
예제 #15
0
 public void onCreateLinkingSuccess(NUserInfo userInfo)
 {
 }
예제 #16
0
 public void onLoginSuccess(NUserInfo userInfo)
 {
     GamePotSettings.MemberInfo = userInfo;
     SceneManager.LoadSceneAsync("Main");
 }