Ejemplo n.º 1
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 0 && pinID != 5)
            {
                return;
            }
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            FlowNode_RequestFriend.\u003COnActivate\u003Ec__AnonStorey2D4 activateCAnonStorey2D4 = new FlowNode_RequestFriend.\u003COnActivate\u003Ec__AnonStorey2D4();
            if (pinID == 5)
            {
                this.is_all = true;
            }
            if (Network.Mode == Network.EConnectMode.Offline)
            {
                this.Success();
            }
            else
            {
                // ISSUE: reference to a compiler-generated field
                activateCAnonStorey2D4.fuid = (string)null;
                if (!string.IsNullOrEmpty(GlobalVars.SelectedFriendID))
                {
                    // ISSUE: reference to a compiler-generated field
                    activateCAnonStorey2D4.fuid = GlobalVars.SelectedFriendID;
                }
                else if (GlobalVars.FoundFriend != null && !string.IsNullOrEmpty(GlobalVars.FoundFriend.FUID))
                {
                    // ISSUE: reference to a compiler-generated field
                    activateCAnonStorey2D4.fuid = GlobalVars.FoundFriend.FUID;
                }
                if (pinID == 5)
                {
                    this.index = 0;
                    FriendWindowItem[] componentsInChildren = (FriendWindowItem[])((Component)this).GetComponentsInChildren <FriendWindowItem>();
                    if (componentsInChildren == null)
                    {
                        this.Success();
                        return;
                    }
                    this.FriendItemList.Clear();
                    for (int index = 0; index < componentsInChildren.Length; ++index)
                    {
                        if (componentsInChildren[index].IsOn)
                        {
                            this.FriendItemList.Add(componentsInChildren[index]);
                        }
                    }
                    if (this.FriendItemList.Count <= 0)
                    {
                        this.Success();
                        return;
                    }
                }
                if (this.is_all && this.FriendItemList != null && this.FriendItemList.Count > this.index)
                {
                    FriendWindowItem friendItem = this.FriendItemList[this.index];
                    // ISSUE: reference to a compiler-generated field
                    activateCAnonStorey2D4.fuid = friendItem.PlayerParam.FUID;
                }
                // ISSUE: reference to a compiler-generated field
                if (activateCAnonStorey2D4.fuid == null)
                {
                    this.Success();
                }
                else
                {
                    // ISSUE: reference to a compiler-generated method
                    FriendData friendData = MonoSingleton <GameManager> .Instance.Player.Friends.Find(new Predicate <FriendData>(activateCAnonStorey2D4.\u003C\u003Em__2C3));

                    if (friendData != null)
                    {
                        string empty = string.Empty;
                        if (friendData.State == FriendStates.Friend)
                        {
                            UIUtility.SystemMessage((string)null, LocalizedText.Get("sys.FRIEND_ALREADY_FRIEND"), (UIUtility.DialogResultEvent)(go => {}), (GameObject)null, false, -1);
                            return;
                        }
                        if (friendData.State == FriendStates.Follow)
                        {
                            UIUtility.SystemMessage((string)null, LocalizedText.Get("sys.FRIEND_ALREADY_FOLLOW"), (UIUtility.DialogResultEvent)(go => {}), (GameObject)null, false, -1);
                            return;
                        }
                    }
                    // ISSUE: reference to a compiler-generated field
                    this.ExecRequest((WebAPI) new ReqFriendReq(activateCAnonStorey2D4.fuid, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                    ((Behaviour)this).set_enabled(true);
                }
            }
        }
Ejemplo n.º 2
0
        public override void OnActivate(int pinID)
        {
            if (((Behaviour)this).get_enabled())
            {
                return;
            }
            List <string>     friendApplyList = new List <string>();
            List <string>     stringList      = new List <string>();
            List <FriendData> friends         = MonoSingleton <GameManager> .Instance.Player.Friends;

            if (pinID == 0)
            {
                if (!string.IsNullOrEmpty(GlobalVars.SelectedFriendID))
                {
                    friendApplyList.Add(GlobalVars.SelectedFriendID);
                }
                else if (GlobalVars.FoundFriend != null && !string.IsNullOrEmpty(GlobalVars.FoundFriend.FUID))
                {
                    friendApplyList.Add(GlobalVars.FoundFriend.FUID);
                }
            }
            else
            {
                FriendWindowItem[] componentsInChildren = (FriendWindowItem[])((Component)this).GetComponentsInChildren <FriendWindowItem>();
                if (componentsInChildren != null && componentsInChildren.Length > 0)
                {
                    for (int index = 0; index < componentsInChildren.Length; ++index)
                    {
                        FriendWindowItem friendWindowItem = componentsInChildren[index];
                        if (friendWindowItem.IsOn)
                        {
                            friendApplyList.Add(friendWindowItem.Support == null ? friendWindowItem.PlayerParam.FUID : friendWindowItem.Support.FUID);
                        }
                        else if (friendWindowItem.IsBlockOn)
                        {
                            stringList.Add(friendWindowItem.Support == null ? friendWindowItem.PlayerParam.FUID : friendWindowItem.Support.FUID);
                        }
                    }
                }
            }
            if (friendApplyList.Count > 0 || stringList.Count > 0)
            {
                for (int i = 0; i < friendApplyList.Count; ++i)
                {
                    FriendData friendData = friends.Find((Predicate <FriendData>)(f => f.FUID == friendApplyList[i]));
                    if (friendData != null && friendData.State == FriendStates.Friend)
                    {
                        UIUtility.SystemMessage((string)null, LocalizedText.Get("sys.FRIEND_ALREADY_FRIEND"), (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(6)), (GameObject)null, false, -1);
                        return;
                    }
                    this.apiType |= 2;
                }
                if (stringList != null && stringList.Count > 0)
                {
                    this.apiType |= 4;
                }
                this.ExecRequest((WebAPI) new ReqFriendBlockApply(friendApplyList.ToArray(), stringList.ToArray(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                ((Behaviour)this).set_enabled(true);
            }
            else
            {
                ((Behaviour)this).set_enabled(false);
                this.ActivateOutputLinks(10);
            }
        }