private void On_IntimacyRela_PrevState(CUIEvent uievent)
        {
            ulong commonUInt64Param = uievent.m_eventParams.commonUInt64Param1;
            uint  tagUInt           = uievent.m_eventParams.tagUInt;
            CFR   cfr = Singleton <CFriendContoller> .instance.model.FRData.GetCfr(commonUInt64Param, tagUInt);

            if (IntimacyRelationViewUT.IsRelaStateConfirm(cfr.state) && !cfr.bReciveOthersRequest)
            {
                cfr.state = COM_INTIMACY_STATE.COM_INTIMACY_STATE_VALUE_FULL;
            }
            if (IntimacyRelationViewUT.IsRelaStateDeny(cfr.state) && !cfr.bReciveOthersRequest)
            {
                cfr.state = IntimacyRelationViewUT.GetStateByDenyState(cfr.state);
            }
            Singleton <EventRouter> .GetInstance().BroadCastEvent("FRDataChange");
        }
        private void On_IntimacyRela_Cancle(CUIEvent uievent)
        {
            ulong commonUInt64Param = uievent.m_eventParams.commonUInt64Param1;
            uint  tagUInt           = uievent.m_eventParams.tagUInt;
            COM_INTIMACY_STATE tag  = (COM_INTIMACY_STATE)uievent.m_eventParams.tag;

            Singleton <CFriendContoller> .instance.model.FRData.ResetChoiseRelaState(commonUInt64Param, tagUInt);

            if (IntimacyRelationViewUT.IsRelaStateConfirm(tag))
            {
                COM_INTIMACY_STATE stateByConfirmState = IntimacyRelationViewUT.GetStateByConfirmState(tag);
                FriendRelationNetCore.Send_CHG_INTIMACY_DENY(commonUInt64Param, tagUInt, stateByConfirmState, COM_INTIMACY_RELATION_CHG_TYPE.COM_INTIMACY_RELATION_ADD);
                CFriendRelationship.FRData.Add(commonUInt64Param, tagUInt, COM_INTIMACY_STATE.COM_INTIMACY_STATE_VALUE_FULL, COM_INTIMACY_RELATION_CHG_TYPE.COM_INTIMACY_RELATION_NULL, 0u, false);
            }
            if (IntimacyRelationViewUT.IsRelaStateDeny(tag))
            {
                COM_INTIMACY_STATE stateByDenyState = IntimacyRelationViewUT.GetStateByDenyState(tag);
                FriendRelationNetCore.Send_CHG_INTIMACY_DENY(commonUInt64Param, tagUInt, stateByDenyState, COM_INTIMACY_RELATION_CHG_TYPE.COM_INTIMACY_RELATION_DEL);
                CFriendRelationship.FRData.Add(commonUInt64Param, tagUInt, stateByDenyState, COM_INTIMACY_RELATION_CHG_TYPE.COM_INTIMACY_RELATION_NULL, 0u, false);
            }
        }
        private void On_IntimacyRela_OK(CUIEvent uievent)
        {
            ulong commonUInt64Param = uievent.m_eventParams.commonUInt64Param1;
            uint  tagUInt           = uievent.m_eventParams.tagUInt;
            COM_INTIMACY_STATE tag  = (COM_INTIMACY_STATE)uievent.m_eventParams.tag;
            int tag2 = uievent.m_eventParams.tag2;

            if (tag == COM_INTIMACY_STATE.COM_INTIMACY_STATE_VALUE_FULL && tag2 != -1)
            {
                CFriendRelationship          fRData     = Singleton <CFriendContoller> .instance.model.FRData;
                CFriendRelationship.FRConfig cFGByIndex = fRData.GetCFGByIndex(tag2);
                if (cFGByIndex == null)
                {
                    return;
                }
                if (IntimacyRelationViewUT.IsRelaState(cFGByIndex.state))
                {
                    if (fRData.FindFrist(cFGByIndex.state) == null)
                    {
                        FriendRelationNetCore.Send_INTIMACY_RELATION_REQUEST(commonUInt64Param, tagUInt, cFGByIndex.state, COM_INTIMACY_RELATION_CHG_TYPE.COM_INTIMACY_RELATION_ADD);
                        Singleton <CFriendContoller> .instance.model.FRData.ResetChoiseRelaState(commonUInt64Param, tagUInt);
                    }
                    else
                    {
                        RelationConfig relaTextCfg = Singleton <CFriendContoller> .instance.model.FRData.GetRelaTextCfg(cFGByIndex.state);

                        if (relaTextCfg != null)
                        {
                            Singleton <CUIManager> .instance.OpenTips(relaTextCfg.IntimRela_Tips_AlreadyHas, true, 1.5f, null, new object[0]);
                        }
                    }
                }
            }
            else if (IntimacyRelationViewUT.IsRelaStateConfirm(tag))
            {
                FriendRelationNetCore.Send_CHG_INTIMACY_CONFIRM(commonUInt64Param, tagUInt, IntimacyRelationViewUT.GetStateByConfirmState(tag), COM_INTIMACY_RELATION_CHG_TYPE.COM_INTIMACY_RELATION_ADD);
            }
            else if (IntimacyRelationViewUT.IsRelaStateDeny(tag))
            {
                FriendRelationNetCore.Send_CHG_INTIMACY_CONFIRM(commonUInt64Param, tagUInt, IntimacyRelationViewUT.GetStateByDenyState(tag), COM_INTIMACY_RELATION_CHG_TYPE.COM_INTIMACY_RELATION_DEL);
            }
        }
		public static void Show_Item_Middle(CUIComponent com, CFR frData, CUIFormScript uiFrom)
		{
			IntimacyRelationViewUT.SetButtonParam(com.m_widgets[16], frData);
			IntimacyRelationViewUT.SetButtonParam(com.m_widgets[14], frData);
			IntimacyRelationViewUT.SetButtonParam(com.m_widgets[12], frData);
			IntimacyRelationViewUT.SetButtonParam(com.m_widgets[7], frData);
			int cDDays = frData.CDDays;
			GameObject obj = Utility.FindChild(com.gameObject, "mengban");
			obj.CustomSetActive(cDDays != -1);
			if (cDDays != -1)
			{
				com.m_widgets[5].CustomSetActive(true);
				com.m_widgets[6].CustomSetActive(false);
				IntimacyRelationViewUT.Set_Middle_Text(com, true, string.Format(UT.FRData().IntimRela_CD_CountDown, cDDays), false);
				return;
			}
			if (frData.state == COM_INTIMACY_STATE.COM_INTIMACY_STATE_VALUE_FULL && cDDays == -1)
			{
				com.m_widgets[5].CustomSetActive(true);
				com.m_widgets[6].CustomSetActive(true);
				com.m_widgets[10].CustomSetActive(false);
				IntimacyRelationViewUT.Set_Drop_Text(com, !frData.bInShowChoiseRelaList, frData);
				IntimacyRelationViewUT.Set_Drop_List(com, frData.bInShowChoiseRelaList);
				IntimacyRelationViewUT.Set_Middle_Text(com, false, string.Empty, false);
			}
			if (IntimacyRelationViewUT.IsRelaState(frData.state))
			{
				com.m_widgets[5].CustomSetActive(true);
				com.m_widgets[6].CustomSetActive(false);
				IntimacyRelationViewUT.Set_Middle_Text(com, true, IntimacyRelationViewUT.GetMiddleTextStr(frData.state), true);
				ushort num;
				CFriendModel.EIntimacyType eIntimacyType;
				bool flag;
				Singleton<CFriendContoller>.instance.model.GetFriendIntimacy(frData.ulluid, frData.worldID, out num, out eIntimacyType, out flag);
				if (num > 0)
				{
					int relaLevel = IntimacyRelationViewUT.CalcRelaLevel((int)num);
					string relaIconByRelaLevel = IntimacyRelationViewUT.GetRelaIconByRelaLevel(relaLevel, frData.state);
					if (!string.IsNullOrEmpty(relaIconByRelaLevel))
					{
						GameObject p = com.m_widgets[10];
						GameObject gameObject = Utility.FindChild(p, "Icon");
						if (gameObject != null)
						{
							Image component = gameObject.GetComponent<Image>();
							if (component != null)
							{
								component.gameObject.CustomSetActive(true);
								component.SetSprite(relaIconByRelaLevel, uiFrom, true, false, false, false);
								component.SetNativeSize();
							}
						}
					}
				}
			}
			if (IntimacyRelationViewUT.IsRelaStateConfirm(frData.state))
			{
				if (frData.bReciveOthersRequest)
				{
					com.m_widgets[5].CustomSetActive(true);
					com.m_widgets[6].CustomSetActive(false);
					COM_INTIMACY_STATE stateByConfirmState = IntimacyRelationViewUT.GetStateByConfirmState(frData.state);
					string relationText = IntimacyRelationViewUT.GetRelationText(stateByConfirmState);
					string txt = string.Format(UT.FRData().IntimRela_Tips_ReceiveOtherReqRela, UT.Bytes2String(frData.friendInfo.szUserName), relationText);
					IntimacyRelationViewUT.Set_Middle_Text(com, true, txt, false);
				}
				else
				{
					com.m_widgets[5].CustomSetActive(true);
					com.m_widgets[6].CustomSetActive(false);
					IntimacyRelationViewUT.Set_Middle_Text(com, true, UT.FRData().IntimRela_Tips_Wait4TargetRspReqRela, false);
				}
			}
			if (IntimacyRelationViewUT.IsRelaStateDeny(frData.state))
			{
				if (frData.bReciveOthersRequest)
				{
					com.m_widgets[5].CustomSetActive(true);
					com.m_widgets[6].CustomSetActive(false);
					COM_INTIMACY_STATE stateByDenyState = IntimacyRelationViewUT.GetStateByDenyState(frData.state);
					string relationText2 = IntimacyRelationViewUT.GetRelationText(stateByDenyState);
					string txt2 = string.Format(UT.FRData().IntimRela_Tips_ReceiveOtherDelRela, UT.Bytes2String(frData.friendInfo.szUserName), relationText2);
					IntimacyRelationViewUT.Set_Middle_Text(com, true, txt2, false);
				}
				else
				{
					com.m_widgets[5].CustomSetActive(true);
					com.m_widgets[6].CustomSetActive(false);
					IntimacyRelationViewUT.Set_Middle_Text(com, true, UT.FRData().IntimRela_Tips_Wait4TargetRspDelRela, false);
				}
			}
		}
示例#5
0
        public void ShowIntimacyNum(int value, CFriendModel.EIntimacyType type, bool bFreeze, COM_INTIMACY_STATE state)
        {
            GameObject gameObject = this.full.transform.parent.FindChild("rela").gameObject;
            bool       flag       = IntimacyRelationViewUT.IsRelaState(state);
            bool       flag2      = IntimacyRelationViewUT.IsRelaStateDeny(state);

            if (flag || flag2)
            {
                this.intimacyNum.gameObject.CustomSetActive(false);
                this.freeze.CustomSetActive(false);
                this.full.CustomSetActive(false);
                this.high.CustomSetActive(false);
                this.mid.CustomSetActive(false);
                this.low.CustomSetActive(false);
                gameObject.CustomSetActive(true);
                COM_INTIMACY_STATE cOM_INTIMACY_STATE = flag2 ? IntimacyRelationViewUT.GetStateByDenyState(state) : state;
                if (cOM_INTIMACY_STATE != COM_INTIMACY_STATE.COM_INTIMACY_STATE_NULL)
                {
                    string relaIcon = IntimacyRelationViewUT.GetRelaIcon(value, cOM_INTIMACY_STATE);
                    if (!string.IsNullOrEmpty(relaIcon))
                    {
                        Image componetInChild = Utility.GetComponetInChild <Image>(gameObject, "icon");
                        if (componetInChild != null)
                        {
                            componetInChild.gameObject.CustomSetActive(true);
                            componetInChild.SetSprite(relaIcon, this.formScript, true, false, false, false);
                        }
                    }
                    Text componetInChild2 = Utility.GetComponetInChild <Text>(gameObject, "txt");
                    if (componetInChild2 != null)
                    {
                        componetInChild2.gameObject.CustomSetActive(true);
                        componetInChild2.set_text(Singleton <CFriendContoller> .instance.model.GetPrefixString(value, state));
                    }
                }
            }
            else
            {
                gameObject.CustomSetActive(false);
                if (this.intimacyNum != null)
                {
                    this.intimacyNum.gameObject.CustomSetActive(true);
                    if ((long)value >= (long)((ulong)Singleton <CFriendContoller> .instance.model.GetIntimacyMaxValue()))
                    {
                        this.intimacyNum.set_text("Max");
                    }
                    else
                    {
                        this.intimacyNum.set_text(value.ToString());
                    }
                }
                if (bFreeze)
                {
                    this.freeze.CustomSetActive(true);
                    this.intimacyNum.set_color(CUIUtility.Intimacy_Freeze);
                }
                else
                {
                    this.freeze.CustomSetActive(false);
                    if (type == CFriendModel.EIntimacyType.Low)
                    {
                        this.full.CustomSetActive(false);
                        this.high.CustomSetActive(false);
                        this.mid.CustomSetActive(false);
                        this.low.CustomSetActive(true);
                        this.intimacyNum.set_color(CUIUtility.Intimacy_Low);
                    }
                    else if (type == CFriendModel.EIntimacyType.Middle)
                    {
                        this.full.CustomSetActive(false);
                        this.high.CustomSetActive(false);
                        this.mid.CustomSetActive(true);
                        this.low.CustomSetActive(false);
                        this.intimacyNum.set_color(CUIUtility.Intimacy_Mid);
                    }
                    else if (type == CFriendModel.EIntimacyType.High)
                    {
                        this.full.CustomSetActive(false);
                        this.high.CustomSetActive(true);
                        this.mid.CustomSetActive(false);
                        this.low.CustomSetActive(false);
                        this.intimacyNum.set_color(CUIUtility.Intimacy_High);
                    }
                    else if (type == CFriendModel.EIntimacyType.full)
                    {
                        this.full.CustomSetActive(true);
                        this.high.CustomSetActive(false);
                        this.mid.CustomSetActive(false);
                        this.low.CustomSetActive(false);
                        this.intimacyNum.set_color(CUIUtility.Intimacy_Full);
                    }
                }
            }
        }