Beispiel #1
0
 static public int TryGetValue(IntPtr l)
 {
     try {
         System.Collections.Generic.Dictionary <System.String, UnityEngine.Sprite> self = (System.Collections.Generic.Dictionary <System.String, UnityEngine.Sprite>)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         UnityEngine.Sprite a2;
         var ret = self.TryGetValue(a1, out a2);
         pushValue(l, ret);
         pushValue(l, a2);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #2
0
    private bool GetAxisDown(string name, float dead)
    {
        bool value = false;

        value = isAxisInUse.TryGetValue(name, out value);

        if (Mathf.Abs(Input.GetAxisRaw(name)) >= dead)
        {
            isAxisInUse[name] = true;
            return(!value);
        }
        else
        {
            isAxisInUse.Remove(name);
        }
        return(false);
    }
Beispiel #3
0
 static public int TryGetValue(IntPtr l)
 {
     try {
         System.Collections.Generic.Dictionary <System.Int32, System.String> self = (System.Collections.Generic.Dictionary <System.Int32, System.String>)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.String a2;
         var           ret = self.TryGetValue(a1, out a2);
         pushValue(l, true);
         pushValue(l, ret);
         pushValue(l, a2);
         return(3);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #4
0
 static int TryGetValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Dictionary <int, TestAccount> obj = (System.Collections.Generic.Dictionary <int, TestAccount>)ToLua.CheckObject(L, 1, TypeTraits <System.Collections.Generic.Dictionary <int, TestAccount> > .type);
         int         arg0 = (int)LuaDLL.luaL_checkinteger(L, 2);
         TestAccount arg1 = null;
         bool        o    = obj.TryGetValue(arg0, out arg1);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.PushSealed(L, arg1);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int TryGetValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Dictionary <int, double> obj = (System.Collections.Generic.Dictionary <int, double>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <int, double>));
         int    arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         double arg1;
         bool   o = obj.TryGetValue(arg0, out arg1);
         LuaDLL.lua_pushboolean(L, o);
         LuaDLL.lua_pushnumber(L, arg1);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #6
0
 static int TryGetValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Dictionary <ulong, sAvatarList> obj = (System.Collections.Generic.Dictionary <ulong, sAvatarList>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <ulong, sAvatarList>));
         ulong       arg0 = (ulong)LuaDLL.luaL_checknumber(L, 2);
         sAvatarList arg1 = null;
         bool        o    = obj.TryGetValue(arg0, out arg1);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.PushObject(L, arg1);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int TryGetValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Dictionary <uint, Logic.Character.EnemyEntity> obj = (System.Collections.Generic.Dictionary <uint, Logic.Character.EnemyEntity>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <uint, Logic.Character.EnemyEntity>));
         uint arg0 = (uint)LuaDLL.luaL_checknumber(L, 2);
         Logic.Character.EnemyEntity arg1 = null;
         bool o = obj.TryGetValue(arg0, out arg1);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.Push(L, arg1);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int TryGetValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Dictionary <int, UnityEngine.GameObject> obj = (System.Collections.Generic.Dictionary <int, UnityEngine.GameObject>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <int, UnityEngine.GameObject>));
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         UnityEngine.GameObject arg1 = null;
         bool o = obj.TryGetValue(arg0, out arg1);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.PushSealed(L, arg1);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int TryGetValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Dictionary <string, SingleData> obj = (System.Collections.Generic.Dictionary <string, SingleData>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <string, SingleData>));
         string     arg0 = ToLua.CheckString(L, 2);
         SingleData arg1 = null;
         bool       o    = obj.TryGetValue(arg0, out arg1);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.PushObject(L, arg1);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int TryGetValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Dictionary <UnityEngine.GameObject, LuaInterface.LuaTable> obj = (System.Collections.Generic.Dictionary <UnityEngine.GameObject, LuaInterface.LuaTable>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <UnityEngine.GameObject, LuaInterface.LuaTable>));
         UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.GameObject));
         LuaInterface.LuaTable  arg1 = null;
         bool o = obj.TryGetValue(arg0, out arg1);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.Push(L, arg1);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #11
0
        public DesiredShape ForLoop()
        {
            var answer = new DesiredShape();

            foreach (var n in Words)
            {
                if (n.Length >= 3)
                {
                    var key = (n[0], n[1], n[2]);
                    if (!answer.TryGetValue(key, out var words))
                    {
                        words       = new List <string>();
                        answer[key] = words;
                    }
                    words.Add(n);
                }
            }

            return(answer);
        }
    private void SendToAll(string csv, Reflective data)
    {
        if (!__debugInitialized)
        {
            SetupSimple();
        }
        if (string.IsNullOrWhiteSpace(csv))
        {
            return;
        }

        Action <string, Reflective> sendAction;

        if (__sendActions.TryGetValue(csv, out sendAction))
        {
            sendAction(csv, data);
            return;
        }

        // Simple case.
        if (!csv.Contains(">>"))
        {
            __sendActions[csv] = SendToAllInternal;
            SendToAllInternal(csv, data);
            return;
        }

        // Chaining
        System.Collections.Generic.List <string> chainedCommands = new System.Collections.Generic.List <string>(csv.Split(new string[] { ">>" }, StringSplitOptions.RemoveEmptyEntries));
        __sendActions[csv] = (_csv, _data) =>
        {
            string first = chainedCommands[0];
            chainedCommands.RemoveAt(0);
            chainedCommands.Add(first);

            Log.Write(LogLevel.Info, "CHAIN Sending to " + first);
            SendToAllInternal(first, _data);
        };
        __sendActions[csv](csv, data);
    }
Beispiel #13
0
    private void PrepareDragDrop(object sender, System.EventArgs args)
    {
        var item = (TreeViewItem)sender;

        try
        {
            if (item == null || !item.IsDraggable)
            {
                return;
            }

            var treeInfo  = (AkTreeInfo)item.DataContext;
            var reference = WwiseObjectReference.FindOrCreateWwiseObject(treeInfo.ObjectType, item.Header, treeInfo.Guid);
            if (!reference)
            {
                return;
            }

            var groupReference = reference as WwiseGroupValueObjectReference;
            if (groupReference)
            {
                var ParentTreeInfo = (AkTreeInfo)item.Parent.DataContext;
                groupReference.SetupGroupObjectReference(item.Parent.Header, ParentTreeInfo.Guid);
            }

            MonoScript script;
            if (DragDropMonoScriptMap.TryGetValue(reference.WwiseObjectType, out script))
            {
                GUIUtility.hotControl = 0;
                DragAndDrop.PrepareStartDrag();
                DragAndDrop.objectReferences           = new Object[] { script };
                AkUtilities.DragAndDropObjectReference = reference;
                DragAndDrop.StartDrag("Dragging an AkObject");
            }
        }
        catch (System.Exception e)
        {
            Debug.Log(e.ToString());
        }
    }
Beispiel #14
0
    public static void GridSplitterOpeningBounce(DefinitionBase RowColDefinition, int InitialSize, bool Opening)
    {
        if (RowColDefinition == null)
        {
            return;                       //for when events fire before everything is initialized
        }
        bool IsRow = (RowColDefinition.GetType() == typeof(RowDefinition));

        Storyboard story;

        if (!GridSplitterPositions.TryGetValue(RowColDefinition, out story))
        {
            GridLengthAnimation animation = new GridLengthAnimation();
            animation.To       = new GridLength(InitialSize);
            animation.Duration = new TimeSpan(0, 0, 1);

            Storyboard.SetTarget(animation, RowColDefinition);
            Storyboard.SetTargetProperty(animation, new PropertyPath(IsRow ? "Height" : "Width"));

            GridSplitterPositions[RowColDefinition] = story = new Storyboard();
            story.Children.Add(animation);
        }

        if (Opening)
        {
            story.Begin();
        }
        else
        {
            story.Stop();

            DependencyProperty CurrentPositionProperty = IsRow ? RowDefinition.HeightProperty : ColumnDefinition.WidthProperty;

            //save the current position in the animation's "To" property so it opens back to where it was before we closed it
            (story.Children[0] as GridLengthAnimation).To = (GridLength)RowColDefinition.GetValue(CurrentPositionProperty);

            RowColDefinition.SetValue(CurrentPositionProperty, new GridLength(0, GridUnitType.Pixel));
        }
    }
    static int TryGetValue(IntPtr L)
    {
        ToLua.CheckArgsCount(L, 3);
        System.Collections.Generic.Dictionary <int, TestAccount> obj = (System.Collections.Generic.Dictionary <int, TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <int, TestAccount>));
        int         arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
        TestAccount arg1 = null;
        bool        o;

        try
        {
            o = obj.TryGetValue(arg0, out arg1);
        }
        catch (Exception e)
        {
            LuaDLL.luaL_error(L, e.Message);
            return(0);
        }

        LuaDLL.lua_pushboolean(L, o);
        ToLua.PushObject(L, arg1);
        return(2);
    }
Beispiel #16
0
 static public int TryGetValue(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         System.Collections.Generic.Dictionary <System.Int32, System.String> self = (System.Collections.Generic.Dictionary <System.Int32, System.String>)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.String a2;
         checkType(l, 3, out a2);
         var ret = self.TryGetValue(a1, out a2);
         pushValue(l, true);
         pushValue(l, ret);
         pushValue(l, a2);
         return(3);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Beispiel #17
0
    public GameObject AssembleCharacter(string label)
    {
        AcData data = DataManager.Instance.CurAcDataList.Find(label);

        if (data == null)
        {
            Debug.LogError("can't find ac data: [" + label + "]");
            return(null);
        }

        AddCharacterToLoad(data.characterId);


        CharacterInformation ci = null;

        if (_activedCharacters.TryGetValue(data.characterId, out ci))
        {
            // prepare ai module prefab.
            GameObject aiModule = InJoy.AssetBundles.AssetBundles.Load(ci.aiAgentPath) as GameObject;
            if (aiModule != null)
            {
                // instance a graphics model.
                GameObject model = CharacterFactory.Singleton.AssembleCharacter(ci.modelPath);
                if (model != null)
                {
                    GameObject ai = GameObject.Instantiate(aiModule) as GameObject;
                    // assemble ActionController
                    ActionController ac = model.GetComponent <ActionController>();
                    if (ac == null)
                    {
                        ac = model.AddComponent <ActionController>();
                    }
                    //ac._data = ci.extraData.Duplicate();
                    ac.Data                    = data;
                    ac._agent                  = ai;
                    ai.transform.parent        = model.transform;
                    ai.transform.localPosition = Vector3.zero;
                    ai.transform.localRotation = Quaternion.identity;
                    ai.transform.localScale    = Vector3.one;

                    //trace all colliders in children
                    //if I find the Damage collider, regist it
                    bool hasFindDamageCollider = false;

                    Collider[] colliders = model.GetComponentsInChildren <Collider>();
                    foreach (Collider collider in colliders)
                    {
                        if (collider.gameObject.name == "DamageCollider")
                        {
                            hasFindDamageCollider = true;
                            ActionControllerManager.Instance.RegisterACByCollider(ac, collider);
                        }
                    }

                    //no damage collider found
                    //register the collider in the root.
                    if (!hasFindDamageCollider)
                    {
                        Collider colliderInRoot = model.GetComponent <Collider>();
                        if ((colliderInRoot != null) && (ActionControllerManager.Instance != null))
                        {
                            ActionControllerManager.Instance.RegisterACByCollider(ac, colliderInRoot);
                        }
                    }

                    // navMesh component settings.
                    NavMeshAgent nma    = model.GetComponentInChildren <NavMeshAgent>();
                    MoveAgent[]  agents = model.GetComponentsInChildren <MoveAgent>();
                    foreach (MoveAgent ma in agents)
                    {
                        ma._navAgent = nma;
                    }

                    return(model);
                }
                else
                {
                    Debug.LogError(string.Format("[CharacterAssembler] Model not found: \"{0}\"", ci.modelPath));
                }
            }
            else
            {
                Debug.LogError(string.Format("[CharacterAssembler] Agent path not found: \"{0}\"", ci.aiAgentPath));
            }
        }
        else
        {
            Debug.LogError(string.Format("[CharacterAssembler] Character id not found: \"{0}\"", data.characterId));
        }

        return(null);
    }
Beispiel #18
0
    public void DealWithSignInItem(int itemIndex, int itemStatus, int vipLevel, IChooseItem ins)
    {
        signAwardLogicInstance = ins;
        m_ItemIndex            = itemIndex;

        if (vipLevel > 0 && GameManager.gameManager.PlayerDataPool.IsServerFlagOpen(SERVER_FLAGS_ENUM.FLAG_VIP))
        {
            vipChooseSpriteInstead = true;
            //m_ChooseVipSprite.gameObject.SetActive(true);
            if (m_VipDoubleSprite != null)
            {
                m_VipDoubleSprite.gameObject.SetActive(true);
            }
            if (m_vipDoubleLable != null)
            {
                m_vipDoubleLable.text = StrDictionary.GetClientDictionaryString("#{11508}", vipLevel);
            }
        }
        else
        {
            vipChooseSpriteInstead = false;
            //m_ChooseVipSprite.gameObject.SetActive(false);
            if (m_VipDoubleSprite != null)
            {
                m_VipDoubleSprite.gameObject.SetActive(false);
            }

            //m_vipDoubleLable.gameObject.SetActive(false);
        }


        m_HaveAwardSprite.gameObject.SetActive(false);
        SetSignInItemHalfVipRewarded(false);
        m_ItemStatus = (DaySignInStates)itemStatus;
        SetOtherMask(m_ItemIndex, (DaySignInStates)itemStatus);
        switch ((DaySignInStates)itemStatus)
        {
        case DaySignInStates.NORMALSIGNED:
        {
            m_HaveAwardSprite.gameObject.SetActive(true);
            if (m_lblBuQian != null)
            {
                m_lblBuQian.SetActive(false);
            }
            //if (vipChooseSpriteInstead)//有vip双倍奖励。
            //{
            //    m_bInFrozenState = false;
            //    ChangeAllWidgetsToColor(m_NormalColor);
            //}
            //else//无VIP双倍奖励并且已经领过,说明这个签到ITEM没有其他可以操作的了。
            {
                m_bInFrozenState = true;
                ChangeAllWidgetsToColor(m_GrayColor);
            }
            if (m_vipBuQian != null)
            {
                m_vipBuQian.SetActive(vipChooseSpriteInstead);
            }

            break;
        }

        case DaySignInStates.NOTSIGNEN:
        {
            ChangeAllWidgetsToColor(m_NormalColor);
            if (m_vipBuQian != null)
            {
                m_vipBuQian.SetActive(false);
            }

            m_bCanBuQian       = CanSupply(itemIndex);
            m_bCanDoNormalSign = CanDoSign(itemIndex);
            int nowday = GameManager.gameManager.PlayerDataPool.DaySignInfo.m_nowDayIndex;
            if (nowday > m_ItemIndex)
            {
                bool sign = true;
                System.Collections.Generic.Dictionary <int, Games.AwardActivity.DaySignInItem> m_DaySignInfoList = GameManager.gameManager.PlayerDataPool.DaySignInfo.m_DaySignInfoList;
                Games.AwardActivity.DaySignInItem daysignitem;
                for (int i = 1; i < m_ItemIndex; ++i)
                {
                    if (m_DaySignInfoList.TryGetValue(i, out daysignitem) && daysignitem.ItemStatus == (int)DaySignInStates.NOTSIGNEN)
                    {
                        sign = false;
                        break;
                    }
                }
                if (m_lblBuQian != null)
                {
                    m_lblBuQian.SetActive(sign);
                }
            }
            break;
        }

        case DaySignInStates.VIPSIGNED:
        {
            ChangeAllWidgetsToColor(m_GrayColor);
            if (m_vipBuQian != null)
            {
                m_vipBuQian.SetActive(false);
            }

            if (m_lblBuQian != null)
            {
                m_lblBuQian.SetActive(false);
            }
            break;
        }

        case DaySignInStates.VIPSIGNEDHALF:
        {
            ChangeAllWidgetsToColor(m_NormalColor);
            if (m_vipBuQian != null)
            {
                m_vipBuQian.SetActive(true);
            }

            if (m_lblBuQian != null)
            {
                m_lblBuQian.SetActive(false);
            }
            SetSignInItemHalfVipRewarded(true);
            break;
        }

        case DaySignInStates.INVALID:
        {
            m_bInFrozenState = true;
            ChangeAllWidgetsToColor(m_NormalColor);
            if (m_vipBuQian != null)
            {
                m_vipBuQian.SetActive(false);
            }

            if (m_lblBuQian != null)
            {
                m_lblBuQian.SetActive(false);
            }
            SetSignInItemHalfVipRewarded(false);
        }
        break;

        default:
        {
            ChangeAllWidgetsToColor(m_NormalColor);
            break;
        }
        }
    }
Beispiel #19
0
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        UserName = Request.Form["UserName"].ToString().Trim();

        Password = Request.Form["Password"].ToString().Trim();

        Password2 = Request.Form["Password2"].ToString().Trim();

        try
        {
            Result = CustBasicInfo.IsExistUser(UserName);
            if (Result != 0)
            {
                errorHint.InnerHtml = "<script type='text/javascript'>showError('用户名已存在!')</script>";
                return;
            }

            Result = UserRegistry.UserRegisterWebLowStint(SPID, UserName, Password, out CustID, out ErrMsg);

            if (Result == 0)
            {
                // 重定向到欢迎页面

                String IPAddress = Request.UserHostAddress.ToString();
                CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, IPAddress, "client_wap");


                String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToRegist&wt=json&from=" + Device + "&custId=" + CustID;
                String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                //{"returnCode":"00000"}
                string youhuiquan = "";
                resuzt.TryGetValue("returnCode", out youhuiquan);


                String        TimeStamp             = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                SPInfoManager spInfo                = new SPInfoManager();
                Object        SPData                = spInfo.GetSPData(this.Context, "SPData");
                String        key                   = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
                String        Digest                = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
                String        temp                  = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
                String        RegistryResponseValue = HttpUtility.UrlEncode(temp);

                //给用户写cookie
                UserToken UT             = new UserToken();
                String    RealName       = UserName;
                String    NickName       = UserName;
                string    UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key, out ErrMsg);
                string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);
                CreateSPTokenRequest();
                StringBuilder URL = new StringBuilder();
                URL.Append("LowSintRegisterMSuccess.aspx?SPID=");
                Response.Redirect(URL.ToString() + SPID + "&SPTokenRequest=" + newSPTokenRequest, true);
            }
            else
            {
                errorHint.InnerHtml = "<script type='text/javascript'>showError('注册失败:" + ErrMsg + "')</script>";
                return;
            }
        }
        catch (Exception exp)
        {
            errorHint.InnerHtml = "<script type='text/javascript'>showError('" + exp.ToString() + "!')</script>";
            return;
        }
    }
    protected void register_Click(object sender, EventArgs e)
    {
        Response.AddHeader("P3P", "CP=CAO PSA OUR");

        UserName = Request.Form["userName"].ToString().Trim();

        PassWord = Request.Form["password"].ToString().Trim();

        PassWord2 = Request.Form["password2"].ToString().Trim();

        checkCode = Request.Form["checkCode"].ToString().Trim();

        String IPAddress = Request.UserHostAddress.ToString();

        System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(Request.Url.AbsoluteUri);
        StringBuilder             sbLog   = new StringBuilder();

        sbLog.AppendFormat("userName:{0}\r\n", UserName);
        sbLog.AppendFormat("password:{0}\r\n", PassWord);
        sbLog.AppendFormat("password2:{0}\r\n", PassWord2);
        sbLog.AppendFormat("checkCode:{0}\r\n", checkCode);
        try
        {
            if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(checkCode), this.Context))
            {
                //hintError提示错误验证码校验未通过
                errorHint.InnerHtml = "验证码校验未通过!";
                sbLog.AppendFormat("验证码校验未通过!");
                return;
            }

            if (!PassWord2.Equals(PassWord))
            {
                errorHint.InnerHtml = "密码不一致!";
                return;
            }

            Result = CustBasicInfo.IsExistUser(UserName);

            if (Result != 0)
            {
                errorHint.InnerHtml = "用户名已经存在!";
                return;
            }

            Result = UserRegistry.UserRegisterWebLowStint(SPID, UserName, PassWord, out CustID, out ErrMsg);

            if (Result == 0)
            {
                //记录注册来源ip地址
                CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, IPAddress, "web_zc");


                if ("35433334".Equals(SPID))
                {
                    String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToRegist&wt=json&from=web&custId=" + CustID;
                    String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                    System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                    //{"returnCode":"00000"}
                    string youhuiquan = "";
                    resuzt.TryGetValue("returnCode", out youhuiquan);
                }


                // 重定向到欢迎页面
                sbLog.AppendFormat("注册成功:{0}\r\n", Result);
                String        TimeStamp             = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                SPInfoManager spInfo                = new SPInfoManager();
                Object        SPData                = spInfo.GetSPData(this.Context, "SPData");
                String        key                   = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
                String        Digest                = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
                String        temp                  = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
                String        RegistryResponseValue = HttpUtility.UrlEncode(temp);
                sbLog.Append("给用户写Cookie\r\n");
                //给用户写cookie
                UserToken UT             = new UserToken();
                String    RealName       = UserName;
                String    NickName       = UserName;
                string    UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key, out ErrMsg);
                string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);
                sbLog.Append("创建新的SPTokenRequest\r\n");
                CreateSPTokenRequest();

                StringBuilder URL = new StringBuilder();
                String        RegisterInLowstintSuccessURL = ConfigurationManager.AppSettings["RegisterInLowstintSuccessURL"].ToString(); //// 邮箱指向authenv2.aspx
                if (String.IsNullOrEmpty(RegisterInLowstintSuccessURL))
                {
                    RegisterInLowstintSuccessURL = "RegisterSuccessV2.aspx?SPID=";
                }
                URL.Append(RegisterInLowstintSuccessURL);
                //Response.Redirect(URL.ToString() + SPID + "&ReturnUrl=" + ReturnUrl + "&SPTokenRequest=" + newSPTokenRequest, false);
                //用Redirect 无法从request  的refer 中获得从哪个页面来的

                //     Server.Transfer

                //Server.Transfer方法把执行流程从当前的ASPX文件转到同一服务器上的另一个ASPX页面。调用Server.Transfer时,当前的ASPX页面终止执行,执行流程转入另一个ASPX页面,但新的ASPX页面仍使用前一ASPX页面创建的应答流。

                //如果用Server.Transfer方法实现页面之间的导航,浏览器中的URL不会改变,因为重定向完全在服务器端进行,浏览器根本不知道服务器已经执行了一次页面变换。

                //默认情况下,Server.Transfer方法不会把表单数据或查询字符串从一个页面传递到另一个页面,但只要把该方法的第二个参数设置成True,就可以保留第一个页面的表单数据和查询字符串。

                //同时,使用Server.Transfer时应注意一点:目标页面将使用原始页面创建的应答流,这导致ASP.NET的机器验证检查(Machine    Authentication    Check,MAC)认为新页面的ViewState已被篡改。因此,如果要保留原始页面的表单数据和查询字符串集合,必须把目标页面Page指令的EnableViewStateMac属性设置成False。
                sbLog.Append("重定向:");
                //Response.Redirect(URL.ToString() + SPID + "&ReturnUrl=" + ReturnUrl + "&SPTokenRequest=" + newSPTokenRequest, true);
                Server.Transfer(URL.ToString() + SPID + "&ReturnUrl=" + ReturnUrl + "&SPTokenRequest=" + newSPTokenRequest, true);
            }
            else
            {
                sbLog.AppendFormat("注册失败:{0}\r\n", ErrMsg);
                errorHint.InnerHtml = "注册失败:" + ErrMsg;
                return;
            }
        }
        catch (Exception ex)
        {
            sbLog.Append(ex.Message);
            errorHint.InnerHtml = ex.ToString();
            return;
            //重定向到错误页面
        }
        finally
        {
            log(sbLog.ToString());
        }
    }
Beispiel #21
0
    public void RebuildMesh()
    {
        ChunkLightmap lightmap = _world.GetLightmap(_chunk.Key);

        var appearances = new System.Collections.Generic.Dictionary <BlockType, BlockAppearance>();

        // air
        appearances.Add(BlockType.Empty, new BlockAppearance());
        // stone
        BlockAppearance tmp = new BlockAppearance();

        for (int i = 0; i < 6; i++)
        {
            tmp.UVRects[i] = _atlas.Rects[0];
            tmp.Colors[i]  = new Color(0.4f, 0.4f, 0.4f);
        }
        appearances.Add(new BlockType(2), tmp);
        // dirt
        tmp = new BlockAppearance();
        for (int i = 0; i < 6; i++)
        {
            if (i != (int)BlockFace.Top)
            {
                tmp.UVRects[i] = _atlas.Rects[1];
            }
            else
            {
                tmp.UVRects[i] = _atlas.Rects[3];
            }
        }
        appearances.Add(new BlockType(1), tmp);
        // grass
        tmp = new BlockAppearance();
        for (int i = 0; i < 6; i++)
        {
            tmp.UVRects[i] = _atlas.Rects[2];
        }
        tmp.UVRects[(int)BlockFace.Top]    = _atlas.Rects[4];
        tmp.UVRects[(int)BlockFace.Bottom] = _atlas.Rects[1];

        appearances.Add(new BlockType(3), tmp);

        Profiler.BeginSample("RebuildMesh");
        for (int x = 0; x < 16; x++)
        {
            for (int y = 0; y < 16; y++)
            {
                for (int z = 0; z < 16; z++)
                {
                    BlockType block = _chunk.GetBlock(x, y, z);
                    if (block.isTransparent() == false && _chunk.IsBlockVisible(x, y, z))
                    {
                        BlockAppearance appearance;
                        if (!appearances.TryGetValue(block, out appearance))
                        {
                            appearance = new BlockAppearance();
                        }

                        CubeBuilder.buildCube(_meshBuilder, new Vector3i(x, y, z), _chunk, lightmap, appearance);
                    }
                }
            }
        }

        _mesh.Clear();
        _meshBuilder.BuildMesh(_mesh);
        _meshBuilder.Clear();
        _dirty = false;
        Profiler.EndSample();
    }
Beispiel #22
0
    public String RegisterInLowstingHttp(String SPID, String UserName, String PassWord, String PassWord2, String Device, String wt)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region 数据校验
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(UserName))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(AuthenCode))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenCode不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "AuthenCode不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        String t_CustID = String.Empty;
        String msg      = String.Empty;
        int    k        = PhoneBO.SelSendSMSMassage(t_CustID, UserName, AuthenCode, out msg);
        if (k != 0)
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "验证码不正确!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证码不正确!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        String regMobile       = @"^1[345678]\d{9}$";
        String regEmail        = @"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$";
        String RegularUserName = @"^[a-zA-Z][a-zA-Z0-9]*([-._]?[a-zA-Z0-9]+)*$";

        if (!ValidateUserName(UserName, regMobile))
        //if (!ValidateUserName(UserName, RegularUserName))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "991");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName只能是手机号码!");
                //ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName不合乎规范!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "991");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName只能是手机号码!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(PassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord2不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord2不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (!PassWord.Equals(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1001");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码不一致!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1001");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码不一致!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        //Result = CustBasicInfo.IsExistUser(UserName);

        //if (Result != 0)
        //{
        //    // 返回错误信息
        //    ResponseMsg.Length = 0;
        //    if ("json".Equals(wt))
        //    {
        //        ResponseMsg.Append("{");
        //        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
        //        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "用户名已经存在!");
        //        ResponseMsg.Append("}");
        //    }
        //    else
        //    {
        //        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        //        ResponseMsg.Append("<PayPlatRequestParameter>");
        //        ResponseMsg.Append("<PARAMETERS>");
        //        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
        //        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "用户名已经存在!");
        //        ResponseMsg.Append("</PARAMETERS>");
        //        ResponseMsg.Append("</PayPlatRequestParameter>");
        //    }
        //    return ResponseMsg.ToString();
        //}



        //验证码校验

        //if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(checkCode), this.Context))
        //{
        //hintError提示错误验证码校验未通过
        //errorHint.InnerHtml = "验证码校验未通过!";
        //return;
        //}


        #endregion



        String appId       = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;
        String appSecret   = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret;
        String version     = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion;
        String clientType  = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
        String clientIp    = HttpContext.Current.Request.UserHostAddress;
        String clientAgent = HttpContext.Current.Request.UserAgent;
        String sendSms     = UDBConstDefinition.DefaultInstance.UnifyPlatformRegisterAccountSendSms;
        if (String.IsNullOrEmpty(sendSms))
        {
            sendSms = "false";
        }

        //综合平台隐式注册只支持手机,也就是说,用户名模式,放弃注册为天翼账号,仅注册为号百用户
        //既有用户名又有手机的,放弃注册天翼账号
        String Unify_ErrMsg = String.Empty;
        String userId       = String.Empty;
        String o_userName   = String.Empty;
        String accessToken  = String.Empty;
        //msg.AppendFormat("注册天翼账号:\r\n");
        int Unify_Result = CIP2BizRules.RegisterUnifyPlatformAccount(appId, appSecret, version, clientType, clientIp, clientAgent, UserName, PassWord, sendSms, out userId, out o_userName, out accessToken, out Unify_ErrMsg);
        //msg.AppendFormat("注册天翼账号,Result:{0},accessToken:{1},userId:{2},usrName:{3},ErrMsg:{4}\r\n", Unify_Result, accessToken, userId, o_userName, Unify_ErrMsg);

        if (Unify_Result == 0 && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(accessToken))
        {
            Result = UserRegistry.UserRegisterWebLowStintV2(SPID, UserName, PassWord, Device, out CustID, out ErrMsg);
            if (Result == 0)
            {
                String IPAddress = Request.UserHostAddress.ToString();
                CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, IPAddress, "client_zc");

                String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToRegist&wt=json&from=" + Device + "&custId=" + CustID;
                String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                //{"returnCode":"00000"}
                string youhuiquan = "";
                resuzt.TryGetValue("returnCode", out youhuiquan);

                //建立绑定关系  (待完成)
                //因暂时不支持lognum

                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                    ResponseMsg.AppendFormat("\"returnCode\":\"{0}\",", youhuiquan);
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "注册成功!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<CustID>{0}</CustID>", CustID);
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "注册成功!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
            else
            {
                // 账号注册失败
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-1");
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", "");
                    ResponseMsg.AppendFormat("\"returnCode\":\"{0}\",", "");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "注册失败!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<CustID>{0}</CustID>", "");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-1");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "注册失败!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        else
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-11");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "天翼账号注册失败!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-11");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "天翼账号注册失败!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
Beispiel #23
0
    public String RegisterInLowstingHttp(String SPID, String UserName, String PassWord, String PassWord2, String Device, String ShareCode, String wt)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region 数据校验
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(UserName))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(AuthenCode))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenCode不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "AuthenCode不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        String t_CustID = String.Empty;
        String msg      = String.Empty;
        int    k        = PhoneBO.SelSendSMSMassage(t_CustID, UserName, AuthenCode, out msg);
        if (k != 0)
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "验证码不正确!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证码不正确!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        String regMobile = @"^1[345678]\d{9}$";
        //String regEmail = @"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$";
        //String RegularUserName = @"^[a-zA-Z][a-zA-Z0-9]*([-._]?[a-zA-Z0-9]+)*$";
        if (!ValidateUserName(UserName, regMobile))
        //if (!ValidateUserName(UserName, RegularUserName))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "991");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName只能是手机号码!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "991");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName只能是手机号码!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(PassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord2不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord2不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (!PassWord.Equals(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1001");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码不一致!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1001");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码不一致!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion

        String appId       = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;
        String appSecret   = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret;
        String version     = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion;
        String clientType  = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
        String clientIp    = HttpContext.Current.Request.UserHostAddress;
        String clientAgent = HttpContext.Current.Request.UserAgent;
        String sendSms     = UDBConstDefinition.DefaultInstance.UnifyPlatformRegisterAccountSendSms;
        if (String.IsNullOrEmpty(sendSms))
        {
            sendSms = "false";
        }

        //综合平台隐式注册只支持手机,也就是说,用户名模式,放弃注册为天翼账号,仅注册为号百用户
        //既有用户名又有手机的,放弃注册天翼账号
        String Unify_ErrMsg = String.Empty;
        String userId       = String.Empty;
        String o_userName   = String.Empty;
        String accessToken  = String.Empty;
        //msg.AppendFormat("注册天翼账号:\r\n");
        int Unify_Result = CIP2BizRules.RegisterUnifyPlatformAccount(appId, appSecret, version, clientType, clientIp, clientAgent, UserName, PassWord, sendSms, out userId, out o_userName, out accessToken, out Unify_ErrMsg);
        //msg.AppendFormat("注册天翼账号,Result:{0},accessToken:{1},userId:{2},usrName:{3},ErrMsg:{4}\r\n", Unify_Result, accessToken, userId, o_userName, Unify_ErrMsg);


        if (Unify_Result == 0 && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(accessToken))
        {
            //Result = UserRegistry.UserRegisterWebLowStintV3(SPID, UserName, PassWord, Device, ShareCode, out CustID, out ErrMsg);
            UDBMBOSS         _UDBMBoss   = new UDBMBOSS();
            UnifyAccountInfo accountInfo = new UnifyAccountInfo();
            Unify_Result = _UDBMBoss.UnifyPlatformGetUserInfo(appId, appSecret, version, clientType, accessToken, clientIp, clientAgent, out accountInfo, out Unify_ErrMsg);
            String OuterID, Status, CustType, CustLevel, NickName, Email, CertificateCode, CertificateType, Sex, RealName, EnterpriseID, ProvinceID, AreaID, RegistrationSource;

            if (Unify_Result == 0 && !String.IsNullOrEmpty(Convert.ToString(accountInfo.userId)))
            {
                String MobileName = String.Empty;
                String EmailName  = String.Empty;
                if (!String.IsNullOrEmpty(accountInfo.nickName))
                {
                    RealName = accountInfo.nickName;
                }
                else if (!String.IsNullOrEmpty(accountInfo.userName))
                {
                    RealName = accountInfo.userName;
                }
                else if (!String.IsNullOrEmpty(accountInfo.mobileName))
                {
                    RealName = accountInfo.mobileName;
                }
                else if (!String.IsNullOrEmpty(accountInfo.emailName))
                {
                    RealName = accountInfo.emailName;
                }
                else
                {
                    RealName = "";
                }
                if (!String.IsNullOrEmpty(accountInfo.mobileName))
                {
                    MobileName = accountInfo.mobileName;
                }
                if (!String.IsNullOrEmpty(accountInfo.emailName))
                {
                    EmailName = accountInfo.emailName;
                }
                String EncrytpPassWord = CryptographyUtil.Encrypt(PassWord);
                String OperType        = "2"; // 注册 ,

                if (!String.IsNullOrEmpty(MobileName) || !String.IsNullOrEmpty(EmailName))
                {
                    CustID = String.Empty;

                    Result = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", MobileName, EmailName, RealName, EncrytpPassWord, accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);

                    if (Result == 0 && !String.IsNullOrEmpty(CustID))
                    {
                        Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                           out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                           out AreaID, out RegistrationSource);
                        CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, Request.UserHostAddress.ToString(), "client_zc");

                        String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToShare&wt=json&from=" + Device + "&registerCustId=" + CustID;
                        String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                        System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                        //{"returnCode":"00000"}
                        string youhuiquan = "";
                        resuzt.TryGetValue("returnCode", out youhuiquan);
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                            ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                            ResponseMsg.AppendFormat("\"returnCode\":\"{0}\",", youhuiquan);
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "注册成功!");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<CustID>{0}</CustID>", CustID);
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "注册成功!");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                }
                else
                {
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-11");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "MobileName或EmailName为空不能注册天翼账号所以号百注册也失败!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-11");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "MobileName或EmailName为空不能注册天翼账号所以号百注册也失败!!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return(ResponseMsg.ToString());
                }
                //http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToShare&wt=json&from=ios&registerCustId=134664179
                //"http://116.228.55.13:8113/facadeHome.do?actions=facadeHome&method=sendCouponToShare&wt=json&from=ios&registerCustId=
            }
            else
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-10");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "号百账号注册失败!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-10");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "号百账号注册失败!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        else
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-10");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "天翼账号注册失败!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-10");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "天翼账号注册失败!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
Beispiel #24
0
    private void DisplayPortForwarding()
    {
        _foldOutScenes = UnityEditor.EditorGUILayout.Foldout(_foldOutScenes, "PortForwading");
        UnityEditor.EditorGUILayout.BeginHorizontal();
        UnityEditor.EditorGUILayout.LabelField("", UnityEngine.GUILayout.MaxWidth(30));
        UnityEditor.EditorGUILayout.BeginVertical();
        if (_foldOutScenes)
        {
            UnityEngine.GUILayout.BeginVertical(UnityEngine.GUI.skin.textField);
            UnityEngine.GUILayout.BeginHorizontal();
            UnityEngine.GUILayout.Label("DeviceId", UnityEditor.EditorStyles.boldLabel, UnityEngine.GUILayout.MinWidth(50));
            UnityEngine.GUILayout.Label("Local Port", UnityEditor.EditorStyles.boldLabel, UnityEngine.GUILayout.MinWidth(50), UnityEngine.GUILayout.MaxWidth(100));
            UnityEngine.GUILayout.Label("Remote Port", UnityEditor.EditorStyles.boldLabel, UnityEngine.GUILayout.MinWidth(50), UnityEngine.GUILayout.MaxWidth(100));
            if (UnityEngine.GUILayout.Button("Refresh", UnityEngine.GUILayout.MinWidth(50), UnityEngine.GUILayout.MaxWidth(100)))
            {
                RefreshDeviceList();
            }
            UnityEngine.GUILayout.EndHorizontal();

            if (devices.Count != 0)
            {
                foreach (var device in devices)
                {
                    if (device.Active)
                    {
                        var styleActive = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.textField);
                        styleActive.normal.background = MakeTexture(20, 20, greenColor);

                        UnityEngine.GUILayout.BeginHorizontal(styleActive);
                        UnityEngine.GUILayout.Label(device.DeviceId, UnityEngine.GUILayout.MinWidth(50));
                        UnityEngine.GUILayout.Label(device.LocalPort.ToString(), UnityEngine.GUILayout.MinWidth(50), UnityEngine.GUILayout.MaxWidth(100));
                        UnityEngine.GUILayout.Label(device.RemotePort.ToString(), UnityEngine.GUILayout.MinWidth(50), UnityEngine.GUILayout.MaxWidth(100));
                        if (UnityEngine.GUILayout.Button("Stop", UnityEngine.GUILayout.MinWidth(50), UnityEngine.GUILayout.MaxWidth(100)))
                        {
                            if (device.Platform == Platform.Android)
                            {
                                AltUnityPortHandler.RemoveForwardAndroid(device.LocalPort, device.DeviceId);
                            }
#if UNITY_EDITOR_OSX
                            else
                            {
                                int id;
                                if (iosForwards.TryGetValue(device.DeviceId, out id))
                                {
                                    AltUnityPortHandler.KillIProxy(id);
                                    iosForwards.Remove(device.DeviceId);
                                }
                            }
#endif

                            device.Active = false;
                            RefreshDeviceList();
                        }
                    }
                    else
                    {
                        var style = UnityEngine.GUI.skin.textField;
                        UnityEngine.GUILayout.BeginHorizontal(style);
                        UnityEngine.GUILayout.Label(device.DeviceId, UnityEngine.GUILayout.MinWidth(50));
                        device.LocalPort  = UnityEditor.EditorGUILayout.IntField(device.LocalPort, UnityEngine.GUILayout.MinWidth(50), UnityEngine.GUILayout.MaxWidth(100));
                        device.RemotePort = UnityEditor.EditorGUILayout.IntField(device.RemotePort, UnityEngine.GUILayout.MinWidth(50), UnityEngine.GUILayout.MaxWidth(100));
                        if (UnityEngine.GUILayout.Button("Start", UnityEngine.GUILayout.MinWidth(50), UnityEngine.GUILayout.MaxWidth(100)))
                        {
                            if (device.Platform == Platform.Android)
                            {
                                var response = AltUnityPortHandler.ForwardAndroid(device.DeviceId, device.LocalPort, device.RemotePort);
                                if (!response.Equals("Ok"))
                                {
                                    UnityEngine.Debug.LogError(response);
                                }
                            }
#if UNITY_EDITOR_OSX
                            else
                            {
                                var response = AltUnityPortHandler.ForwardIos(device.DeviceId, device.LocalPort, device.RemotePort);
                                if (response.StartsWith("Ok"))
                                {
                                    var processID = int.Parse(response.Split(' ')[1]);
                                    iosForwards.Add(device.DeviceId, processID);
                                    device.Active = true;
                                }
                                else
                                {
                                    UnityEngine.Debug.LogError(response);
                                }
                            }
#endif
                            RefreshDeviceList();
                        }
                    }

                    UnityEngine.GUILayout.EndHorizontal();
                }
            }
            else
            {
                UnityEditor.EditorGUILayout.TextArea("No devices connected. Click \"refresh\" button to search for devices");
            }
            UnityEngine.GUILayout.EndVertical();
        }

        UnityEditor.EditorGUILayout.EndVertical();
        UnityEditor.EditorGUILayout.EndHorizontal();
    }
    protected override void SetOtherMask(int itemindex, DaySignInStates type)
    {
        switch (type)
        {
        case DaySignInStates.INVALID:
            StopEffect();
            m_Mask.SetActive(false);
            break;

        case DaySignInStates.NOTSIGNEN:
            int nowday = GameManager.gameManager.PlayerDataPool.DaySignInfo.m_nowDayIndex;
            if (nowday == itemindex)
            {
                PlayEffect();
                m_lblBuQian.SetActive(false);
            }
            else
            {
                StopEffect();
                if (nowday > itemindex)
                {
                    bool sign = true;
                    System.Collections.Generic.Dictionary <int, Games.AwardActivity.DaySignInItem> m_DaySignInfoList = GameManager.gameManager.PlayerDataPool.DaySignInfo.m_DaySignInfoList;
                    Games.AwardActivity.DaySignInItem daysignitem;
                    for (int i = 1; i < itemindex; ++i)
                    {
                        if (m_DaySignInfoList.TryGetValue(i, out daysignitem) && daysignitem.ItemStatus == (int)DaySignInStates.NOTSIGNEN)
                        {
                            sign = false;
                            break;
                        }
                    }
                    m_lblBuQian.SetActive(sign);
                }
            }
            m_Mask.SetActive(false);
            break;

        case DaySignInStates.NORMALSIGNED:
            StopEffect();
            m_Mask.SetActive(true);
            break;

        case DaySignInStates.VIPSIGNEDHALF:
            StopEffect();
            int nowdayv = GameManager.gameManager.PlayerDataPool.DaySignInfo.m_nowDayIndex;
            if (nowdayv > itemindex)
            {
                bool sign = true;
                System.Collections.Generic.Dictionary <int, Games.AwardActivity.DaySignInItem> m_DaySignInfoList = GameManager.gameManager.PlayerDataPool.DaySignInfo.m_DaySignInfoList;
                Games.AwardActivity.DaySignInItem daysignitem;
                for (int i = 1; i < itemindex; ++i)
                {
                    if (m_DaySignInfoList.TryGetValue(i, out daysignitem) && (daysignitem.ItemStatus == (int)DaySignInStates.NOTSIGNEN || daysignitem.ItemStatus == (int)DaySignInStates.VIPSIGNEDHALF))
                    {
                        sign = false;
                        break;
                    }
                }
                m_vipBuQian.SetActive(sign);
            }
            m_Mask.SetActive(false);
            break;

        case DaySignInStates.VIPSIGNED:
            StopEffect();
            m_Mask.SetActive(true);
            break;
        }
    }
    protected override void ItemClick(GameObject value)
    {
        int nItemType = -1;
        int nItemID   = -1;
        int nCount    = 0;

        for (int i = 0; i < m_ItemGrid.Length && i < m_ItemDataID.Length; i++)
        {
            if (m_ItemGrid[i].name == value.name)
            {
                nItemType = m_ItemType[i];
                nItemID   = m_ItemDataID[i];
                nCount    = m_ItemCount[i];
                break;
            }
        }
        //Frozen状态只显示TIPS没有其他操作
        if (m_bInFrozenState)
        {
            if (nItemType == (int)ItemType.ITEM_ITEM)
            {
                if (nItemID <= -1)
                {
                    return;
                }
                GameItem item = new GameItem();
                item.DataID = nItemID;
                MonthSignItemIntroduce.ShowMoneyTip(MoneyTipsLogic.MoneyType.ITEM_NONE, nItemID);
                if (item.IsEquipMent())
                {
                    //EquipTooltipsLogic.ShowEquipTooltip(item, EquipTooltipsLogic.ShowType.Info);
                }
                else
                {
                    //ItemTooltipsLogic.ShowItemTooltip(item, ItemTooltipsLogic.ShowType.Info);
                }
            }
            else
            {
                MoneyTipsLogic.MoneyType tpye = MoneyTipsLogic.MoneyType.ITEM_NONE;
                switch ((ItemType)nItemType)
                {
                case ItemType.ITEM_EXP:
                    tpye = MoneyTipsLogic.MoneyType.ITEM_EXP;
                    break;

                case ItemType.ITEM_MONEY:
                    tpye = MoneyTipsLogic.MoneyType.ITEM_MONEY;
                    break;

                case ItemType.ITEM_YUANBAO:
                    tpye = MoneyTipsLogic.MoneyType.ITEM_YUANBAO;
                    break;
                }
                //MoneyTipsLogic.ShowMoneyTip(tpye, nCount);
                MonthSignItemIntroduce.ShowMoneyTip(tpye, nCount);
            }
        }
        else
        {
            int nowdayv = GameManager.gameManager.PlayerDataPool.DaySignInfo.m_nowDayIndex;
            if (nowdayv > m_ItemIndex)
            {
                System.Collections.Generic.Dictionary <int, Games.AwardActivity.DaySignInItem> m_DaySignInfoList = GameManager.gameManager.PlayerDataPool.DaySignInfo.m_DaySignInfoList;
                Games.AwardActivity.DaySignInItem daysignitem;
                if (m_DaySignInfoList.TryGetValue(m_ItemIndex, out daysignitem))
                {
//                    DaySignInStates states = (DaySignInStates)daysignitem.ItemStatus;
                    if (daysignitem.ItemStatus == (int)DaySignInStates.NOTSIGNEN)
                    {
                        for (int i = 1; i < m_ItemIndex; ++i)
                        {
                            if (m_DaySignInfoList.TryGetValue(i, out daysignitem) && daysignitem.ItemStatus == (int)DaySignInStates.NOTSIGNEN)
                            {
                                GUIData.AddNotifyData2Client(false, "#{11515}");
                                return;
                            }
                        }
                    }
                    else if (daysignitem.ItemStatus == (int)DaySignInStates.VIPSIGNEDHALF)
                    {
                        for (int i = 1; i < m_ItemIndex; ++i)
                        {
                            if (m_DaySignInfoList.TryGetValue(i, out daysignitem) && (daysignitem.ItemStatus == (int)DaySignInStates.NOTSIGNEN || daysignitem.ItemStatus == (int)DaySignInStates.VIPSIGNEDHALF))
                            {
                                GUIData.AddNotifyData2Client(false, "#{11515}");
                                return;
                            }
                        }
                    }
                }
            }
            if (AwardLogic.Instance() != null)
            {
                AwardLogic.Instance().m_PopUpBox.AddItem((RewardAwardItem.ItemType)nItemType,
                                                         nItemID, nCount, m_ItemIndex, (int)m_ItemStatus, vipLevel: m_nVipLevel, sureAction: ChangeChooseItem,
                                                         isDefaultCanDoSign: m_bCanDoNormalSign);
            }
        }
    }
Beispiel #27
0
    public void Terrain_Initialise(int iSeed, int iNumPieces)
    {
        Terrain_ShutDown();

        m_fTimeUntilNextFalloff = m_fTimeBetweenFalloff;

        GameObject templateTerrainPiece = (GameObject)Resources.Load("Prefabs/GroundBlock", typeof(GameObject));
        float      fOuterRadius         = templateTerrainPiece.transform.localScale.x;
        float      fInnerRadius         = fOuterRadius * 0.86602540378443864676372317075294f;                            // (cos(30°)
        Vector2    translateX           = new Vector2(fInnerRadius * 2, 0);
        Vector2    translateY           = new Vector2(fInnerRadius, fInnerRadius * 1.7320508075688772935274463415059f);  // fInnerRadius*1.7320508075688772935274463415059 == √((fInnerRadius+fInnerRadius)² - fInnerRadius²)
        Vector2    translateZ           = new Vector2(fInnerRadius, fInnerRadius * -1.7320508075688772935274463415059f); // fInnerRadius*1.7320508075688772935274463415059 == √((fInnerRadius+fInnerRadius)² - fInnerRadius²)

        Random.seed = iSeed;                                                                                             // Seed the random number generator, so all clients (including the host) generate the same terrain.

        uint uiTotalRecommendation = 0;

        System.Collections.Generic.Dictionary <long, Adjacent> builder = new System.Collections.Generic.Dictionary <long, Adjacent>();

        // Create all terrain pieces.
        for (uint uiLoop = 0; uiLoop < iNumPieces; ++uiLoop)
        {
            // Find where the new piece will be placed.
            Adjacent.Index newPos = new Adjacent.Index(0, 0, 0);
            if (uiLoop != 0)            // If this is not the first piece...
            {
                // Spawn from one of the recommended locations, using the Roulette Wheel genetic algorithm.
                uint uiSelection = (uint)Random.Range(0, (int)uiTotalRecommendation);

                foreach (System.Collections.Generic.KeyValuePair <long, Adjacent> pair in builder)
                {
                    // Ignore pieces that have already been populated.
                    if (pair.Value.m_TerrainPiece != null)
                    {
                        continue;
                    }

                    // Before using Roulette Wheel selection, ensure the pieces of terrain that are part of the initial solid arena are created.
                    newPos.SetAs(pair.Key);
                    if (pair.Value.m_uiRecommendation >= 5 && new Vector3(translateX.x * newPos.x + translateY.x * newPos.y + translateZ.x * newPos.z, templateTerrainPiece.transform.position.y, translateX.y * newPos.x + translateY.y * newPos.y + translateZ.y * newPos.z).magnitude - fOuterRadius <= m_fRadiusOfInitialSolidArena)
                    {
                        break;                          // Create this piece by using 'newPos'.
                    }
                    // Check if this is the winner of Roulette Wheel selection.
                    if (uiSelection < pair.Value.m_uiRecommendation)
                    {
                        break;                  // Create this piece by using 'newPos'.
                    }
                    else                        // Not winner.
                    {
                        uiSelection -= pair.Value.m_uiRecommendation;
                    }
                }
            }

            // Create new terrain piece.
            GameObject terrainPiece =
                (GameObject)GameObject.Instantiate
                (
                    templateTerrainPiece,
                    new Vector3
                    (
                        translateX.x * newPos.x + translateY.x * newPos.y + translateZ.x * newPos.z,
                        templateTerrainPiece.transform.position.y,
                        translateX.y * newPos.x + translateY.y * newPos.y + translateZ.y * newPos.z
                    ),
                    templateTerrainPiece.transform.localRotation
                );

            terrainPiece.name = "Terrain " + uiLoop + " (" + newPos.x + "x " + newPos.y + "y " + newPos.z + "z)";

            Adjacent adjacent = null;
            if (builder.TryGetValue(newPos, out adjacent))
            {
                // If the terrain piece in 'adjacent' is already set, then the terrain has been generated far too large - no more pieces can be created.
                if (adjacent.m_TerrainPiece != null)
                {
                    break;                      // Stop creating terrain.
                }
                adjacent.m_TerrainPiece = terrainPiece;
            }
            else
            {
                adjacent = new Adjacent(terrainPiece);
                builder.Add(newPos, adjacent);
            }

            if (terrainPiece.transform.position.magnitude - fOuterRadius <= m_fRadiusOfSmallestArena) // If this piece of terrain is within the radius of the final arena, then preserve this piece...
            {
                m_TerrainPieces_Preserved.Add(terrainPiece);                                          // Add this piece to the list of terrain pieces that will not crumble.
            }
            else                                                                                      // Outside the radius of the smallest arena...
            {
                m_TerrainPieces.Insert(0, terrainPiece);                                              // Add this piece to the list of terrain pieces that can crumble.
            }
            uiTotalRecommendation -= adjacent.m_uiRecommendation;

            // Increment recommendation of all surrounding pieces (plus create them if they do not exist yet).
            Adjacent.Index relativePos;

            relativePos = newPos.Relative(-1, -0, -0);
            if (relativePos.x >= -1048576)              // Only bother if the value is within range of the bits allocated (20 bits).
            {
                if (!builder.TryGetValue(relativePos, out adjacent))
                {
                    adjacent = new Adjacent();
                    builder.Add(relativePos, adjacent);
                }

                if (adjacent.m_TerrainPiece == null)
                {
                    ++adjacent.m_uiRecommendation;
                    ++uiTotalRecommendation;
                }
            }

            relativePos = newPos.Relative(+1, +0, +0);
            if (relativePos.x < 1048576)                // Only bother if the value is within range of the bits allocated (20 bits).
            {
                if (!builder.TryGetValue(relativePos, out adjacent))
                {
                    adjacent = new Adjacent();
                    builder.Add(relativePos, adjacent);
                }

                if (adjacent.m_TerrainPiece == null)
                {
                    ++adjacent.m_uiRecommendation;
                    ++uiTotalRecommendation;
                }
            }

            relativePos = newPos.Relative(-0, -1, -0);
            if (relativePos.y >= -1048576)              // Only bother if the value is within range of the bits allocated (20 bits).
            {
                if (!builder.TryGetValue(relativePos, out adjacent))
                {
                    adjacent = new Adjacent();
                    builder.Add(relativePos, adjacent);
                }

                if (adjacent.m_TerrainPiece == null)
                {
                    ++adjacent.m_uiRecommendation;
                    ++uiTotalRecommendation;
                }
            }

            relativePos = newPos.Relative(+0, +1, +0);
            if (relativePos.y < 1048576)                // Only bother if the value is within range of the bits allocated (20 bits).
            {
                if (!builder.TryGetValue(relativePos, out adjacent))
                {
                    adjacent = new Adjacent();
                    builder.Add(relativePos, adjacent);
                }

                if (adjacent.m_TerrainPiece == null)
                {
                    ++adjacent.m_uiRecommendation;
                    ++uiTotalRecommendation;
                }
            }

            relativePos = newPos.Relative(-0, -0, -1);
            if (relativePos.z >= -1048576)              // Only bother if the value is within range of the bits allocated (20 bits).
            {
                if (!builder.TryGetValue(relativePos, out adjacent))
                {
                    adjacent = new Adjacent();
                    builder.Add(relativePos, adjacent);
                }

                if (adjacent.m_TerrainPiece == null)
                {
                    ++adjacent.m_uiRecommendation;
                    ++uiTotalRecommendation;
                }
            }

            relativePos = newPos.Relative(+0, +0, +1);
            if (relativePos.z < 1048576)                // Only bother if the value is within range of the bits allocated (20 bits).
            {
                if (!builder.TryGetValue(relativePos, out adjacent))
                {
                    adjacent = new Adjacent();
                    builder.Add(relativePos, adjacent);
                }

                if (adjacent.m_TerrainPiece == null)
                {
                    ++adjacent.m_uiRecommendation;
                    ++uiTotalRecommendation;
                }
            }
        }
    }
Beispiel #28
0
    private void GetTddata2(HttpContext context)
    {
        string soapaddr = GetDCS();

        HttpRequest  req  = context.Request;
        HttpResponse resp = context.Response;

        string method    = req.QueryString["method"];
        string classpath = req.QueryString["classpath"];

        if (classpath == null)
        {
            classpath = req.Form["classpath"];
        }

        string filter = null;

        filter = req.QueryString["filter"];

        if (filter == null)
        {
            filter = req.Form["filter"];
        }

        //clear
        resp.Clear();
        resp.ClearHeaders();
        resp.ClearContent();

        //
        if (method.Equals("altitude"))
        {
            string path = MapHelper.GetAltitude(soapaddr, classpath, filter);
            if (path != null)
            {
                resp.StatusCode = 200;
                string isCompress = req.QueryString["Compress"];
                if (isCompress == "true")
                {
                    resp.ContentType = "zip";
                    MemoryStream ms    = new MemoryStream();
                    ZipFile      zFile = ZipFile.Create(ms);
                    zFile.BeginUpdate();
                    ZipDataSource ds = new ZipDataSource(path);
                    zFile.Add(ds, Path.GetFileName(path));
                    zFile.CommitUpdate();
                    zFile.Close();
                    ms.Close();

                    resp.OutputStream.Write(ms.ToArray(), 0, ms.ToArray().Length);
                }
                else
                {
                    byte[] buffer = File.ReadAllBytes(path);
                    resp.OutputStream.Write(buffer, 0, buffer.Length);
                }
            }
            else
            {
                resp.StatusCode = 404;
            }
        }
        else
        {
            try
            {
                byte[] tddata = MapHelper.GetTDData(soapaddr, method, classpath, filter);
                if (tddata != null)
                {
                    if (tddata.Length == 0)
                    {
                        resp.StatusCode = 200;
                    }
                    else
                    {
                        resp.ContentType = "text/xml";
                        resp.StatusCode  = 200;
                        resp.OutputStream.Write(tddata, 0, tddata.Length);
                    }
                }
                else
                {
                    resp.StatusCode = 404;
                }
            }
            catch (Exception tdata)
            {
                resp.StatusCode = 404;
            }

            if (method.Equals("FeatAttr2"))
            {
                string[] tmp = classpath.Split(';');
                if (tmp.Length == 3)
                {
                    string mapName = tmp[0] + "|" + tmp[1];
                    long   count   = 0;
                    try
                    {
                        if (dataDic.ContainsKey(mapName))
                        {
                            dataDic.TryGetValue(mapName, out count);
                            count++;
                        }
                        dataDic[mapName] = count;
                    }
                    catch (Exception countEx)
                    {
                        dataDic = new System.Collections.Generic.Dictionary <string, long>();
                        dataDic.Add(mapName, count);
                    }

                    string time        = DateTime.Now.ToString();
                    string respHead    = "本次连接状态:" + resp.StatusCode + " " + resp.StatusDescription;
                    string remoteIp    = req.UserHostAddress;
                    string requestData = "查询数据:" + mapName + "\r\n本次服务器开机该数据访问计数:" + count;
                    string info        = time + "\r\n远程用户:" + remoteIp + "\r\n" + requestData + "\r\n" + respHead;
                    try
                    {
                        TddataLog.WriteLine(info + "\r\n");
                    }
                    catch (Exception ioe)
                    {
                    }
                }
            }
        }
    }