Exemplo n.º 1
0
        protected static GlobalUserInfo m_pGlobalUserInfo;                      //用户信息

        //函数定义

        //构造函数
        private GlobalUserInfo()
        {
            m_GlobalUserData     = new tagGlobalUserData();
            m_IndividualUserData = new tagIndividualUserData();
            m_UserInsureInfo     = new tagUserInsureInfo();
            m_GrowLevelParameter = new tagGrowLevelParameter();

            m_SpreadersInfo       = new tagSpreadersInfo();
            m_ChildrenPaymentInfo = new tagChildrenPaymentInfo();
        }
Exemplo n.º 2
0
    public void OnButtonDelSpreader()
    {
        GameNet.GlobalUserInfo   pGlobalUserInfo      = GameNet.GlobalUserInfo.GetInstance();
        GameNet.tagSpreadersInfo pGlobalSpreadersInfo = pGlobalUserInfo.GetSpreadersInfo();

        if (m_infoIdxToRemove >= 0 && m_infoIdxToRemove < pGlobalSpreadersInfo.wItemCount)
        {
            GameNet.SpreaderInfoItem infoItem = pGlobalSpreadersInfo.SpreaderInfoItems[m_infoIdxToRemove];

            string strRealName = GameNet.GlobalUserInfo.GBToUtf8(infoItem.RealName);
            //int len = strRealName.Length;
            //var szSpreaderRealName = Encoding.UTF8.GetBytes(strRealName);

            ///string strIDCardNo = GameNet.GlobalUserInfo.GBToUtf8(infoItem.IDCardNo);
            string strTelNum        = GameNet.GlobalUserInfo.GBToUtf8(infoItem.TelNum);
            string strWeiXinAccount = GameNet.GlobalUserInfo.GBToUtf8(infoItem.WeiXinAccount);
            GameNet.UserInfo.getInstance().addDelSpreader(infoItem.SpreaderId, strRealName, strTelNum, strWeiXinAccount, infoItem.ParentID, infoItem.SpreaderLevel, false);
        }
    }
Exemplo n.º 3
0
    public void UpdateSpreadersListView()
    {
        if (SurrogateInfoWin == null)
        {
            return;
        }

        var viewportContent = SurrogateInfoWin.transform.Find("SurrogateInfo/Viewport/Content");

        if (viewportContent == null)
        {
            return;
        }
        //设置Content的Bottom
        Vector2 offsetMin = viewportContent.GetComponent <RectTransform>().offsetMin;

        offsetMin.y = -400.0f;
        viewportContent.GetComponent <RectTransform>().offsetMin = offsetMin;

        var Surrogate_1 = viewportContent.Find("Surrogate_1");

        if (Surrogate_1 == null)
        {
            return;
        }
        Surrogate_1.gameObject.SetActive(false);

        GameNet.GlobalUserInfo   pGlobalUserInfo      = GameNet.GlobalUserInfo.GetInstance();
        GameNet.tagSpreadersInfo pGlobalSpreadersInfo = pGlobalUserInfo.GetSpreadersInfo();
        Debug.Log("Surrogate:CreateSpreadersListView:wItemCount=" + pGlobalSpreadersInfo.wItemCount);

        //填充数据
        float curAnchoredPosY = Surrogate_1.GetComponent <RectTransform>().anchoredPosition.y;
        float posStep         = 50;
        int   nItemNum        = pGlobalSpreadersInfo.wItemCount;// *10;

        if (m_infoItemObjList.Count < nItemNum)
        {
            for (int j = m_infoItemObjList.Count; j < nItemNum; j++)
            {
                var infoItemObj = Instantiate(Surrogate_1.gameObject);
                infoItemObj.transform.SetParent(viewportContent);
                infoItemObj.transform.localScale = Surrogate_1.localScale;
                //infoItemObj.SetActive(false);

                m_infoItemObjList.Add(infoItemObj);
            }
        }
        for (int i = 0; i < m_infoItemObjList.Count; i++)
        {
            m_infoItemObjList[i].SetActive(false);
        }
        for (int i = 0; i < nItemNum; i++)
        {
            ///int i = k % pGlobalSpreadersInfo.wItemCount;

            GameNet.SpreaderInfoItem spreaderInfoItem = pGlobalSpreadersInfo.SpreaderInfoItems[i];

            ////校验自己名下的代理
            //uint dwSelfUserId = pGlobalUserData.dwUserID;
            //if (pGlobalUserData.iSpreaderLevel == 0)
            //{
            //    //全显示
            //}
            //else if (pGlobalUserData.iSpreaderLevel == 3)
            //{
            //    break;
            //}

            //bool bIsMyChild = IsMyChild(pGlobalUserData.dwUserID, pGlobalUserData.iSpreaderLevel, spreaderInfoItem.SpreaderId);
            //if (!bIsMyChild)
            //{
            //    continue;
            //}

            /*
             * else if (pGlobalUserData.iSpreaderLevel == 1)
             * {
             *  if (spreaderInfoItem.ParentID == dwSelfUserId)
             *  {
             *      //直属代理
             *      bIsMyChild = true;
             *  }
             *  else
             *  {
             *      for (int j = 0; j < nItemNum; j++)
             *      {
             *          GameNet.SpreaderInfoItem tmpInfoItem1 = pGlobalSpreadersInfo.SpreaderInfoItems[j];
             *          if (spreaderInfoItem.ParentID == tmpInfoItem1.SpreaderId && tmpInfoItem1.ParentID == dwSelfUserId)
             *          {
             *              //间接代理:隔1层
             *              bIsMyChild = true;
             *          }
             *      }
             *  }
             *
             *  if (!bIsMyChild)
             *  {
             *      continue;
             *  }
             * }
             * else if (pGlobalUserData.iSpreaderLevel == 2)
             * {
             *  bIsMyChild = (spreaderInfoItem.ParentID == dwSelfUserId);
             *  if (!bIsMyChild)
             *  {
             *      continue;
             *  }
             * }
             * //*/

            GameObject infoItemObj = m_infoItemObjList[i];
            if (infoItemObj == null)
            {
                continue;
            }
            infoItemObj.SetActive(true);

            //序号
            var numObj = infoItemObj.transform.Find("SurrogateNum");
            if (numObj != null)
            {
                numObj.GetComponent <Text>().text = Convert.ToString(i + 1);
            }

            //姓名
            var nameObj = infoItemObj.transform.Find("SurrogateName");
            if (nameObj != null)
            {
                string strName = GameNet.GlobalUserInfo.GBToUtf8(spreaderInfoItem.RealName);
                nameObj.GetComponent <Text>().text = strName;
            }

            //代理ID
            var idObj = infoItemObj.transform.Find("SurrogateID");
            if (idObj != null)
            {
                idObj.GetComponent <Text>().text = spreaderInfoItem.SpreaderId.ToString();
            }

            //上级代理ID
            var parentIdObj = infoItemObj.transform.Find("HigherLevelSuttogateID");
            if (parentIdObj != null)
            {
                parentIdObj.GetComponent <Text>().text = spreaderInfoItem.ParentID.ToString();
            }

            //代理等级
            var levelObj = infoItemObj.transform.Find("SurrogateGrading");
            if (levelObj != null)
            {
                levelObj.GetComponent <Text>().text = spreaderInfoItem.SpreaderLevel.ToString();
            }

            //微信号
            var weiXinObj = infoItemObj.transform.Find("WeiXin");
            if (weiXinObj != null)
            {
                string strWeiXin = Encoding.Default.GetString(spreaderInfoItem.WeiXinAccount);
                weiXinObj.GetComponent <Text>().text = strWeiXin;
            }

            //电话
            var telNumObj = infoItemObj.transform.Find("TelNum");
            if (telNumObj != null)
            {
                string strTelNum = Encoding.Default.GetString(spreaderInfoItem.TelNum);
                telNumObj.GetComponent <Text>().text = strTelNum;
            }

            //邀请码
            var inviteObj = infoItemObj.transform.Find("Invite");
            if (inviteObj != null)
            {
                string strCode = IdToInviteCode(spreaderInfoItem.SpreaderId);
                //uint userId = InviteCodeToId(strCode);
                inviteObj.GetComponent <Text>().text = strCode;
            }

            //选项框
            var removeToggle = infoItemObj.transform.Find("Info1").GetComponent <Toggle>();
            ///var toggleGroup = Surrogate_1.GetComponent<ToggleGroup>();
            //removeToggle.group = toggleGroup;
            removeToggle.onValueChanged.RemoveAllListeners();
            int idx = i;
            removeToggle.onValueChanged.AddListener(delegate(bool isOn)
            {
                this.OnRemoveToggleValueChanged(isOn, removeToggle.gameObject, idx);
            });


            //Set Pos
            Vector3 anchoredPos = Surrogate_1.GetComponent <RectTransform>().anchoredPosition;
            anchoredPos.y = curAnchoredPosY;
            infoItemObj.GetComponent <RectTransform>().anchoredPosition = anchoredPos;
            curAnchoredPosY -= posStep;

            //设置Content的Bottom
            Vector2 offsetMinTmp = viewportContent.GetComponent <RectTransform>().offsetMin;
            offsetMinTmp.y -= posStep;
            viewportContent.GetComponent <RectTransform>().offsetMin = offsetMinTmp;
        }

        Surrogate_1.gameObject.SetActive(false);
    }
Exemplo n.º 4
0
    //是否是下级代理
    private bool IsMyChild(uint myUserID, int mySpreaderLevel, uint childUserIDToCheck)
    {
        GameNet.GlobalUserInfo   pGlobalUserInfo      = GameNet.GlobalUserInfo.GetInstance();
        GameNet.tagSpreadersInfo pGlobalSpreadersInfo = pGlobalUserInfo.GetSpreadersInfo();

        //获取这个childUser的SpreaderInfoItem
        bool bIsChildUserInSpreaderList = false;
        int  nItemNum = pGlobalSpreadersInfo.wItemCount;

        GameNet.SpreaderInfoItem childSpreaderInfoItem = new GameNet.SpreaderInfoItem();
        for (int i = 0; i < nItemNum; i++)
        {
            if (pGlobalSpreadersInfo.SpreaderInfoItems[i].SpreaderId == childUserIDToCheck)
            {
                bIsChildUserInSpreaderList = true;
                childSpreaderInfoItem      = pGlobalSpreadersInfo.SpreaderInfoItems[i];
                break;
            }
        }
        if (!bIsChildUserInSpreaderList)
        {
            //这个childUser不是代理(不在代理人列表中)
            return(false);
        }

        bool bIsMyChild = false;

        switch (mySpreaderLevel)
        {
        case 0:
            bIsMyChild = true;
            break;

        case 1:
            if (childSpreaderInfoItem.ParentID == myUserID)
            {
                //直属代理
                bIsMyChild = true;
            }
            else
            {
                for (int j = 0; j < nItemNum; j++)
                {
                    GameNet.SpreaderInfoItem tmpInfoItem1 = pGlobalSpreadersInfo.SpreaderInfoItems[j];
                    if (childSpreaderInfoItem.ParentID == tmpInfoItem1.SpreaderId && tmpInfoItem1.ParentID == myUserID)
                    {
                        //间接代理:隔1层
                        bIsMyChild = true;
                        break;
                    }
                }
            }
            break;

        case 2:
            bIsMyChild = (childSpreaderInfoItem.ParentID == myUserID);
            break;

        case 3:
            bIsMyChild = false;
            break;

        default:
            bIsMyChild = false;
            break;
        }

        return(bIsMyChild);
    }