Ejemplo n.º 1
0
        private bool SetupChatStampMaster()
        {
            string src = AssetManager.LoadTextData(ChatStamp.CHAT_STAMP_MASTER_PATH);

            if (string.IsNullOrEmpty(src))
            {
                return(false);
            }
            try
            {
                JSON_ChatStampParam[] jsonArray = JSONParser.parseJSONArray <JSON_ChatStampParam>(src);
                if (jsonArray == null)
                {
                    throw new InvalidJSONException();
                }
                this.mStampParams = new ChatStampParam[jsonArray.Length];
                for (int index = 0; index < jsonArray.Length; ++index)
                {
                    ChatStampParam chatStampParam = new ChatStampParam();
                    if (chatStampParam.Deserialize(jsonArray[index]))
                    {
                        this.mStampParams[index] = chatStampParam;
                    }
                }
                this.MaxPage = jsonArray.Length % ChatStamp.STAMP_VIEW_MAX <= 0 ? jsonArray.Length / ChatStamp.STAMP_VIEW_MAX : jsonArray.Length / ChatStamp.STAMP_VIEW_MAX + 1;
            }
            catch
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        private void Refresh()
        {
            if (this.mStampParams == null || this.mStampParams.Length <= 0)
            {
                return;
            }
            if ((this.mStampObjects == null || this.mStampObjects.Length <= 0) && (Object.op_Inequality((Object)this.StampListRoot, (Object)null) && this.StampListRoot.get_childCount() > 0))
            {
                this.mStampObjects = new GameObject[this.StampListRoot.get_childCount()];
                for (int index = 0; index < this.StampListRoot.get_childCount(); ++index)
                {
                    Transform child = this.StampListRoot.GetChild(index);
                    if (Object.op_Inequality((Object)child, (Object)null))
                    {
                        this.mStampObjects[index] = ((Component)child).get_gameObject();
                        ((Component)child).get_gameObject().SetActive(false);
                    }
                }
            }
            if (this.mStampObjects == null || this.mStampObjects.Length <= 0)
            {
                return;
            }
            for (int index = 0; index < this.mStampObjects.Length; ++index)
            {
                this.mStampObjects[index].get_transform().set_localScale(new Vector3(0.7f, 0.7f, 0.7f));
                this.mStampObjects[index].SetActive(false);
            }
            int num = ChatStamp.STAMP_VIEW_MAX * this.mCurrentPageIndex;

            for (int index = 0; index < this.mStampObjects.Length && num + index < this.mStampParams.Length; ++index)
            {
                ChatStampParam mStampParam = this.mStampParams[num + index];
                if (mStampParam != null)
                {
                    // ISSUE: object of a compiler-generated type is created
                    // ISSUE: variable of a compiler-generated type
                    ChatStamp.\u003CRefresh\u003Ec__AnonStorey23C refreshCAnonStorey23C = new ChatStamp.\u003CRefresh\u003Ec__AnonStorey23C();
                    // ISSUE: reference to a compiler-generated field
                    refreshCAnonStorey23C.\u003C\u003Ef__this = this;
                    // ISSUE: reference to a compiler-generated field
                    refreshCAnonStorey23C.index = index;
                    // ISSUE: reference to a compiler-generated field
                    refreshCAnonStorey23C.id = mStampParam.id;
                    GameObject mStampObject = this.mStampObjects[index];
                    Sprite     sprite       = this.mStampImages.GetSprite(mStampParam.img_id);
                    Image      component1   = (Image)mStampObject.GetComponent <Image>();
                    if (Object.op_Inequality((Object)component1, (Object)null))
                    {
                        component1.set_sprite(!Object.op_Inequality((Object)sprite, (Object)null) ? (Sprite)null : sprite);
                    }
                    Button component2 = (Button)this.mStampObjects[index].GetComponent <Button>();
                    if (Object.op_Inequality((Object)component2, (Object)null))
                    {
                        ((UnityEventBase)component2.get_onClick()).RemoveAllListeners();
                        // ISSUE: method pointer
                        ((UnityEvent)component2.get_onClick()).AddListener(new UnityAction((object)refreshCAnonStorey23C, __methodptr(\u003C\u003Em__253)));
                    }
                    mStampObject.SetActive(true);
                }
            }
        }