Exemple #1
0
    private void PressSkill(bool aisState, ObscuredInt skill)
    {
        if (aisState)
        {
            DATA_SKILL_NEW pSkillTbl = CDATA_SKILL_NEW.Get(skill);
            if (pSkillTbl == null)
            {
                return;
            }

            _skillToolTip.SetActive(aisState);

            _skillName.text     = StringTableManager.GetData(pSkillTbl.iSkillNameStringID);
            _skillContents.text = UtilFunc.ParseSkillText(pSkillTbl);
        }
        else
        {
            _skillToolTip.SetActive(aisState);
        }
    }
Exemple #2
0
    public void InitHeroTween()
    {
        var hero = BattleHeroManager.Instance.GetHeroControl(ActiveTurnHeroNo);

        if (hero != null)
        {
            hero.InitHeroTween();
            hero.IsMyTurn = false;

            UtilFunc.ChangeLayersRecursively(hero.transform, Define.DEFAULT_LAYER);
        }

        hero = BattleHeroManager.Instance.GetHeroControl(ActiveTargetHeroNo);
        if (hero != null)
        {
            hero.InitHeroTween();

            UtilFunc.ChangeLayersRecursively(hero.transform, Define.DEFAULT_LAYER);
        }
    }
Exemple #3
0
    // Instantiate 하지 않은 크리쳐로딩.
    public static GameObject CreatureDefaultLoadPrefab(string aPrefabName)
    {
#if ASSET_BUNDLE
        GameObject resultObj = ResourceBundle.intance.ResourceObject(UtilFunc.GetCreatureBundleName(aPrefabName), aPrefabName, typeof(GameObject)) as GameObject;
#else
        GameObject resultObj = Resources.Load(UtilFunc.GetCreatureResName(aPrefabName)) as GameObject;
#endif
        if (resultObj == null)
        {
#if DEBUG_LOG
            Debug.LogError(string.Format("<color=red>UIResourceMgr->CreatureDefaultLoadPrefab 크리쳐 모델 로드 실패 모델 리소스 {0} 가 존재하지 않는다.</color>", aPrefabName));
#endif
            return(null);
        }

#if ASSET_BUNDLE
        ReLinkAtlas(resultObj);
#endif

        return(resultObj);
    }
Exemple #4
0
        protected void OnBuZhang(ISFSObject data)
        {
            if (IsBuZhangFinish)
            {
                IsBuZhangFinish = false;
                BuZhang.Clear();
            }

            var seat        = data.GetInt(RequestKey.KeySeat);
            var buZhangCard = data.GetIntArray("buZhangCard");
            var cards       = data.GetIntArray(RequestKey.KeyCards);
            var buData      = new BuZhangData {
                Chair = UtilFunc.GetChairId(seat), Cards = cards, BuZhangCards = buZhangCard
            };

            BuZhang.Add(buData);
            foreach (var bCard in buZhangCard)
            {
                BuZhangList[seat].Add(bCard);
            }
        }
Exemple #5
0
        protected virtual void OnHu(EventData evn)
        {
            GameResult data = (GameResult)evn.data1;
            //显示吃碰杠特效
            EnCpgEffect effect = EnCpgEffect.none;

            if (data.HuType == MjRequestData.MJRequestTypeHu)
            {
                effect = EnCpgEffect.hu;
            }
            else if (data.HuType == MjRequestData.MJReqTypeZiMo)
            {
                effect = EnCpgEffect.zimo;
            }

            //游金胡特效
            switch (data.QzmjHuType)
            {
            case QzmjHuType.youjin: effect = EnCpgEffect.youjin; break;

            case QzmjHuType.shuangyou: effect = EnCpgEffect.shuangyou; break;

            case QzmjHuType.sanyou: effect = EnCpgEffect.sanyou; break;

            case QzmjHuType.sanjindao: effect = EnCpgEffect.sanjindao; break;
            }

            foreach (int i in data.HuSeat)
            {
                var chair = UtilFunc.GetChairId(i);
                PlayersPnl.PlayEffect(chair, effect);
            }

            GetOpreateMenu().Reset();
            if (TrusteeshipHelper.Instance != null)
            {
                //取消托管
                TrusteeshipHelper.Instance.OnDisableTrusteeshipClick();
            }
        }
Exemple #6
0
        public virtual void SetChooseCg(List <int[]> cgList, DVoidInt call, int outPutCard = UtilDef.NullMj)
        {
            gameObject.SetActive(true);
            CgGroup.Clear();

            for (int i = 0; i < cgList.Count; i++)
            {
                var valueList = new List <int>(cgList[i]);
                if (valueList.Count < 4 && outPutCard != UtilDef.NullMj)
                {
                    valueList.Add(outPutCard);
                }

                valueList.Sort((a, b) =>
                {
                    if (a > b)
                    {
                        return(1);
                    }
                    if ((a < b))
                    {
                        return(-1);
                    }
                    return(0);
                });

                UiCardGroup group = D2MahjongMng.Instance.GetGroup(valueList.ToArray(), EnD2MjType.Me, true);
                CgGroup.AddUiCdGroup(group);
                int i1 = i;
                group.SetClickCallFunc(() =>
                {
                    UtilFunc.OutPutArray(cgList[i1], "选着的牌");
                    call(i1);
                    gameObject.SetActive(false);
                });
            }

            CgGroup.Sort(1);
        }
Exemple #7
0
        public void ShowThrowEffectOnYoujin(int eventId, EventData evn)
        {
            if ((UIEventId)eventId == UIEventId.ShowThrowEffectOnYoujin)
            {
                int seat = (int)evn.data1;
                int type = (int)evn.data2;

                //显示吃碰杠特效
                EnCpgEffect effect = EnCpgEffect.none;

                //游金胡特效
                switch (type)
                {
                case 2: effect = EnCpgEffect.shuangyou; break;

                case 3: effect = EnCpgEffect.sanyou; break;
                }

                var chair = UtilFunc.GetChairId(seat);
                PlayersPnl.PlayEffect(chair, effect);
            }
        }
Exemple #8
0
    /// <summary>
    /// 생성한 길드멤버 리스트를 정렬한다.
    /// </summary>
    private void SortMemberList()
    {
        // 정렬변경 -> 1. 멤버상태(길드장->부길드장->길드원으로 정렬) -> 2. 오늘 로그인했나 -> 3. 기여도
        m_MemberList = m_MemberList.OrderBy((data) => data.MemberInfo.kMemberState)
                       .ThenByDescending((data) => UtilFunc.TodayLogon(data.MemberInfo.kLastLogonTime.GetDateTime()))
                       .ThenByDescending((data) => data.MemberInfo.kUserTributeExp).ToList();


        int iCount = m_MemberList.Count;

        for (int i = 0; i < iCount; ++i)
        {
            GuildInformationItem member = m_MemberList[i];
            if (member == null)
            {
                continue;
            }

            member.name = i.ToString();
        }

        ResetPosition();
    }
Exemple #9
0
        private void OnRevWallMahjongFinish()
        {
            //获得最后一个牌墙的位置
            var lastChair = _getMahjongChair;

            if (lastChair != UtilFunc.GetPerChair(lastChair, WallMj.Length))
            {
                var len = WallMj.Length;
                for (int i = 0; i < len; i++)
                {
                    var curChair = UtilFunc.GetPerChair(lastChair, WallMj.Length);
                    if (curChair != _getMahjongChair && WallMj[curChair].GetMjCnt() > 0)
                    {
                        lastChair = curChair;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            WallMj[lastChair].RevPopMahjong();
        }
Exemple #10
0
 public string Test()
 {
     try
     {
         if (_context != null && _context.Database != null && _context.Database.EnsureCreated())
         {
             if (_context.Users.FirstOrDefault(x => x.UserName == "admin") != null)
             {
                 return("exist");
             }
             _context.Users.Add(new User
             {
                 Id          = Guid.NewGuid(),
                 UserName    = "******",
                 DisplayName = "管理员",
                 Password    = UtilFunc.SHA256("123abc"),
                 RoleValue   = 1
             });
             if (_context.SaveChanges() > 0)
             {
                 return("success");
             }
             else
             {
                 return("false");
             }
         }
         else
         {
             return("error");
         }
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Exemple #11
0
    //===================================================================================
    //
    // Default Method
    //
    //===================================================================================

    //===================================================================================
    //
    // Method
    //
    //===================================================================================
    public bool SetIcon(ulong kCreatureUniqueIdx, enCreatureIcon_Type type)
    {
        ItemCreature myCreature = UserInfo.Instance.InventoryInfo.GetMyCreature(kCreatureUniqueIdx);

        if (myCreature == null)
        {
#if DEBUG_LOG
            Debug.Log(string.Format("<color=red>크리쳐 키 : {0} 에 해당하는 크리쳐가 인벤에 없다.</color>", kCreatureUniqueIdx));
#endif
            return(false);
        }

        _CreatureTableData = UtilFunc.GetCreatureDataByTID(myCreature.Index);
        if (_CreatureTableData == null)
        {
#if DEBUG_LOG
            Debug.Log("<color=red>DATA_CREATURE_NEWVER 테이블 정보 오류</color>");
#endif
            return(false);
        }

        m_CreatureIconType = type;
        _CreatureKey       = kCreatureUniqueIdx;

        if (m_ReinforceLevelLabel != null)
        {
            m_ReinforceLevelLabel.text = string.Format("{0}{1}", "+", myCreature.ForceCount);
        }
        if (m_LevelLabel != null)
        {
            m_LevelLabel.text = string.Format("{0}{1}", StringTableManager.GetData(12), myCreature.Level);
        }

        SetDefaultIcon(_CreatureTableData.iCreatureName, _CreatureTableData.m_szIcon, _CreatureTableData.m_enCreatureArmy.ToString(), _CreatureTableData.m_iGrade, myCreature.Awake, _CreatureTableData.m_iQuality);

        return(true);
    }
Exemple #12
0
    private bool GuildNameCheck(string strName, out string error)
    {
        bool bCompleted = true;

        error = string.Empty;

        int iGuildNameLength = strName.Length;

        if (iGuildNameLength < 1) // 1글자 미만.
        {
            // 사용할 길드 이름을 입력해주세요
            error      = StringTableManager.GetData(6262);
            bCompleted = false;
        }
        else if (iGuildNameLength > m_iGuildCreateStringCount)  // 15글자 넘어가면.
        {
            // 길드 이름이 최대 글자수를 초과 하었습니다.
            error      = StringTableManager.GetData(6514);
            bCompleted = false;
        }

        if (UtilFunc.IsEmptyCharacters(strName) == true)
        {
            // 특수문자, 금칙어는 사용할 수 없습니다.
            error      = StringTableManager.GetData(6231);
            bCompleted = false;
        }

        if (UtilFunc.IsSpecialAndFiterCharacters(strName) == true) // 특수기호와 금칙어 사용 여부.
        {
            // 특수문자, 금칙어는 사용할 수 없습니다.
            error      = StringTableManager.GetData(6231);
            bCompleted = false;
        }

        return(bCompleted);
    }
    /// <summary>
    /// 유저정보 셋팅.
    /// </summary>
    private void SetOtherUserInfo(_stCharSimpleInfo kCharSimpleInfo)
    {
        m_UserNameLbl.text = kCharSimpleInfo.kDestCharName;
        m_LevLbl.text      = string.Format("{0} {1}", StringTableManager.GetData(12), kCharSimpleInfo.kDestCharLevel);

        float fResult = UtilFunc.GetUserExpPercent(kCharSimpleInfo.kDestCharExp, kCharSimpleInfo.kDestCharExp);

        m_ExpImg.fillAmount  = fResult;
        m_ExpPercentLbl.text = string.Format("{0:F2} {1}", (fResult * 100), "%");

        // 대표 크리쳐 셋팅.
        string cretureName = CDATA_CREATURE_NEWVER.Get(kCharSimpleInfo.kDestCharLearderCreatureID).m_szIcon;

        m_MainCharImg.sprite2D = UIResourceMgr.CreateSprite(BUNDLELIST.TEXTURE_ICON_CREATUREHEAD, cretureName);

#if VIP_SYSTEM
        DATA_VIP datavip = CDATA_VIP.Get(kCharSimpleInfo.kDestCharVIPLevel);
        if (datavip != null)
        {
            m_SprVipGrade.spriteName = datavip.szGradeImg;
            m_LabelVipGrade.text     = string.Format(StringTableManager.GetData(4984), (int)kCharSimpleInfo.kDestCharVIPLevel);
        }
#endif
    }
Exemple #14
0
    /// <summary>
    /// 강화정보와 레벨정보를 기본값으로 셋팅하려고 사용한다.
    /// </summary>
    /// <param name="iCreatureID"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    public bool SetIcon(int iCreatureID, enCreatureIcon_Type type)
    {
        _CreatureTableData = UtilFunc.GetCreatureDataByTID(iCreatureID);
        if (_CreatureTableData == null)
        {
            // error
            return(false);
        }

        m_CreatureIconType = type;

        if (m_ReinforceLevelLabel != null)
        {
            m_ReinforceLevelLabel.text = "+ 0";
        }
        if (m_LevelLabel != null)
        {
            m_LevelLabel.text = string.Format("{0}{1}", StringTableManager.GetData(12), " 1");
        }

        SetDefaultIcon(_CreatureTableData.iCreatureName, _CreatureTableData.m_szIcon, _CreatureTableData.m_enCreatureArmy.ToString(), _CreatureTableData.m_iGrade, 0, _CreatureTableData.m_iQuality);

        return(true);
    }
Exemple #15
0
    // Instantiate 한 크리쳐 모델 로드하고 리턴.
    public static GameObject CreateCreatureModel(string szResourceName, string changeName, Transform parent, SetTransformType TransformType)
    {
#if ASSET_BUNDLE
        GameObject OriginObj = ResourceBundle.intance.ResourceObject(UtilFunc.GetCreatureBundleName(szResourceName), szResourceName, typeof(GameObject)) as GameObject;
#else
        GameObject OriginObj = Resources.Load(UtilFunc.GetCreatureResName(szResourceName)) as GameObject;
#endif
        if (OriginObj == null)
        {
#if DEBUG_LOG
            Debug.LogError(string.Format("<color=red>UIResourceMgr->LoadInstantiateCreatureModel 크리쳐 모델 로드 실패 모델 리소스 {0} 가 존재하지 않는다.</color>", szResourceName));
#endif
            return(null);
        }

        if (string.IsNullOrEmpty(changeName) == true)
        {
            changeName = OriginObj.name;
        }

        GameObject resultObj = InstantiateGameObject(OriginObj, parent, TransformType, changeName);

        return(resultObj);
    }
Exemple #16
0
 public void SetScrollViewDepth(int parentDepth)
 {
     UtilFunc.SetPanelDepth(_scrollView.panel, parentDepth + 5);
 }
Exemple #17
0
    private void MakeUseCreatureData()
    {
        InventoryInfo pInven = UserInfo.Instance.InventoryInfo;

        if (pInven == null)
        {
            return;
        }

        Dictionary <ulong, ItemCreature> pDicValue = pInven.MapInvenCreature;

        if (pDicValue == null)
        {
            return;
        }

        _CreatureList.Clear();

        // 등급순 -> 레벨순으로 정렬.
        foreach (KeyValuePair <ulong, ItemCreature> dicvalue in pDicValue.OrderByDescending((data) => data.Value.Grade).ThenByDescending((data) => data.Value.Level))
        {
            ulong kCreatureKey = dicvalue.Key;

            if (UtilFunc.IsDispatching(kCreatureKey) == true)                                    // 파견중인 크리쳐는 제낌.
            {
                continue;
            }

            ItemCreature         pMy           = UserInfo.Instance.InventoryInfo.GetMyCreature(kCreatureKey);
            DATA_CREATURE_NEWVER pCreatureData = UtilFunc.GetCreatureDataByTID(pMy.Index);

            if (pCreatureData.m_iGrade < (int)m_DispatchTableData.RequireGrade)      // 필요등급 검사
            {
                continue;
            }

            if (pMy.Level < m_DispatchTableData.RequireLevel)                  // 필요레벨 검사
            {
                continue;
            }

            if (UserInfo.Instance.CreatureTeam.HasTempCreatureAll(kCreatureKey))        // 팀에 속해있는지 검사
            {
                continue;
            }

            CreatureItemInfo info = new CreatureItemInfo();
            info.Init(kCreatureKey, pMy, pCreatureData);
            info.SetDispatchSelect(false, string.Empty);

            _CreatureList.Add(info);
        }

        // 전에 보냈던 크리쳐가 있으면 다시 정렬.
        for (int i = 0; i < m_DispatchRecvData.vCreatureKey.Count; i++)
        {
            foreach (CreatureItemInfo info in _CreatureList)
            {
                if (m_DispatchRecvData.vCreatureKey[i] == info.CreatureKey)
                {
                    CreatureItemInfo oldInfo = info;
                    _CreatureList.Remove(info);
                    _CreatureList.Insert(i, oldInfo);       // 전에 보냈던 순서대로 Insert
                    break;
                }
            }
        }
    }
    private void SetDispatchButton(bool bDispatchSuccess, TimeSpan TimeResult)
    {
        m_SuccessObj.SetActive(false);
        _BigSuccessObj.SetActive(false);

        if (bDispatchSuccess == false /*&& m_DispatchRecvData.kDispatchState == _enDispatchState.eDispatchState_INPROGRESSING*/)
        {
            m_RewardButton.SetActive(false);

            m_CloseButton.SetActive(true);
            m_ProgressButton.SetActive(true);

            TimeSpan tsTotalGap = m_DispatchEndTime - m_DispatchStartTime;
            //TimeSpan tsCurrGap = TimeResult;

            double fPercent = TimeResult.TotalMilliseconds / tsTotalGap.TotalMilliseconds;
            if (fPercent > 1f)
            {
                fPercent = 1f;
            }
            else if (fPercent < 0f)
            {
                fPercent = 0f;
            }

            m_QuickCost = (int)(m_DispatchTableData.QuickCost * fPercent);
            m_ImmediatelyCompleteCountLabel.text = m_QuickCost.ToString();

            m_ProgressGageSprite.fillAmount = 1 - (float)(TimeResult.TotalSeconds / (m_DispatchTableData.RequireTime * 60));

            if (TimeResult.Hours > 0)
            {
                // 4915	{0}시간 {1}분 남음
                m_ProgressGageLabel.text = string.Format(StringTableManager.GetData(4915), TimeResult.Hours, TimeResult.Minutes);
            }
            else if (TimeResult.Minutes > 0)
            {
                // 4916	{0}분 남음
                m_ProgressGageLabel.text = string.Format(StringTableManager.GetData(4916), TimeResult.Minutes);
            }
            else if (TimeResult.Seconds > 0)
            {
                // 4959	1분 미만
                m_ProgressGageLabel.text = StringTableManager.GetData(4959);
            }
        }
        else if (bDispatchSuccess == true /*&& m_DispatchRecvData.kDispatchState == _enDispatchState.eDispatchState_COMPLETE*/)
        {
            m_CloseButton.SetActive(false);
            m_ProgressButton.SetActive(false);

            m_RewardButton.SetActive(true);

            UIPanel SuccessPanel = null;
            if (m_DispatchRecvData.kDispatchState == _enDispatchState.eDispatchState_BIGCOMPLETE)
            {
                _BigSuccessObj.SetActive(true);
                SuccessPanel = _BigSuccessObj.GetComponent <UIPanel>();

                m_RewardButtonLabel.text = StringTableManager.GetData(6727); // 6727	보상 수령 X2.
            }
            else
            {
                m_SuccessObj.SetActive(true);
                SuccessPanel = m_SuccessObj.GetComponent <UIPanel>();

                m_RewardButtonLabel.text = StringTableManager.GetData(6726); // 6726	보상 수령.
            }

            // 크리쳐 아이콘 뎁스 =  m_iPanelDepth + 1
            // 크리쳐 아이콘 뎁스보다 높아야 하기때문에 뎁스를 높인다.
            if (m_CreatureIconList.Count > 1)
            {
                UIPanel IconPanel = m_CreatureIconList[0].GetComponent <UIPanel>();
                UtilFunc.SetPanelDepth(SuccessPanel, IconPanel.depth + 1);
            }
        }
    }
Exemple #19
0
    //===================================================================================
    //
    // Method
    //
    //===================================================================================
    public void Init(enGuildInfo_WindowType type, ulong kGuildKey, CGuildMember member)
    {
        m_DelegationButtonLabel.text = StringTableManager.GetData(6294);     // 6294	길드장 위임
        m_AppointButtonLabel.text    = StringTableManager.GetData(6298);     // 6298	부길드장 임명

        m_BgMeSprite.gameObject.SetActive(false);
        m_CaptainCrown.gameObject.SetActive(false);
        m_SubCaptainCrown.gameObject.SetActive(false);

        m_kGuildKey  = kGuildKey;
        m_MemberInfo = member;

        m_NameLabel.text = m_MemberInfo.kCharName;

        m_LevelLabel.text = string.Format("{0} {1}", StringTableManager.GetData(12), m_MemberInfo.kCharLevel);  // 12번 텍스트 LV

        DATA_VIP VipData = CDATA_VIP.Get(m_MemberInfo.kCharVIPLevel);

        if (VipData != null)
        {
            m_VipRankSprite.spriteName = VipData.szGradeImg;
        }
        m_VipRankLabel.text = string.Format(StringTableManager.GetData(4984), (int)m_MemberInfo.kCharVIPLevel);

        DATA_CREATURE_NEWVER CreatureData = CDATA_CREATURE_NEWVER.Get(m_MemberInfo.kLeaderCreatureID);

        if (CreatureData != null)
        {
            int iCreatureTID = CDATA_CREATURE_NEWVER.Get(m_MemberInfo.kLeaderCreatureID).m_iCreatureTID;
            DATA_CREATURE_NEWVER pCreatureData = UtilFunc.GetCreatureDataByTID(iCreatureTID);
            m_CreatureSprite.sprite2D = UIResourceMgr.CreateSprite(BUNDLELIST.TEXTURE_ICON_CREATUREHEAD, pCreatureData.m_szIcon);
        }

        // 공물형태가 무엇인지?
        {
            // 6856	무료 공물
            _GoddnessTributeFreeLabel.text = StringTableManager.GetData(6856);
            _GoddnessTributeFreeObj.SetActive(false);
            _GoddnessTributeGoodObj.SetActive(false);
            _GoddnessTributeExtraObj.SetActive(false);

            _attendanceReward.state = ButtonState.Off;

            DateTime MemberAttendanceTime = m_MemberInfo.kGuildAttendanceTime.GetDateTime();
            if (MemberAttendanceTime.Date >= TimeManager.Instance.GetServerTime().Date&&
                (m_MemberInfo.kBuffKind != DATA_GUILD_TRIBUTE._enTributeEnum.None && m_MemberInfo.kBuffKind != DATA_GUILD_TRIBUTE._enTributeEnum._enTributeEnum_Max))
            {
                _attendanceReward.state = ButtonState.On;

                DATA_GUILD_TRIBUTE._enTributeEnum GuildBuffKind = m_MemberInfo.kBuffKind;
                DATA_GUILD_TRIBUTE GuildTributeData             = CDATA_GUILD_TRIBUTE.Get(GuildBuffKind);
                if (GuildTributeData == null)
                {
                    return;     // error
                }
                _attendanceReward.SetOnLabel(string.Format(StringTableManager.GetData(8679), GuildTributeData.iKeyAmount));

                int iCount = CDATA_GUILD_MAIN.GetCount();
                for (int i = 0; i < iCount; ++i)
                {
                    DATA_GUILD_MAIN GuildMainData = CDATA_GUILD_MAIN.GetByIndex(i);
                    if (GuildMainData == null)
                    {
                        continue;
                    }

                    if (GuildMainData.enTributeFree == GuildBuffKind)
                    {
                        _GoddnessTributeFreeObj.SetActive(true);
                        break;
                    }
                    else if (GuildMainData.enTributeGood == GuildBuffKind)
                    {
                        _GoddnessTributeGoodObj.SetActive(true);
                        break;
                    }
                    else if (GuildMainData.enTributeExtra == GuildBuffKind)
                    {
                        _GoddnessTributeExtraObj.SetActive(true);
                        break;
                    }
                }
            }
        }

        if (type == enGuildInfo_WindowType.MyGuild)
        {
            _ContributionTitleLabel.gameObject.SetActive(true);
            _ContributionPointLabel.gameObject.SetActive(true);
            _attendanceReward.gameObject.SetActive(true);

            // 6905    기여도
            _ContributionTitleLabel.text = StringTableManager.GetData(6905);
            _ContributionPointLabel.text = m_MemberInfo.kUserTributeExp.ToString();     // 기여도 점수.
        }
        else
        {
            _ContributionTitleLabel.gameObject.SetActive(false);
            _ContributionPointLabel.gameObject.SetActive(false);
            _attendanceReward.gameObject.SetActive(false);
        }

        if (m_MemberInfo.kAccessState == _enGuildMemberAccessState.eAccess_Yes)
        {
            _MemberLogOffObj.SetActive(false);

            // 3473	접속중
            m_LastConnectLabel.text = string.Format(StringTableManager.GetData(3473));
        }
        else
        {
            if (UserInfo.Instance.CharNo == m_MemberInfo.kCharNo)
            {
                _MemberLogOffObj.SetActive(false);

                // 3473	접속중
                m_LastConnectLabel.text = string.Format(StringTableManager.GetData(3473));
            }
            else
            {
                if (m_kGuildKey == UserInfo.Instance.GuildKey)
                {
                    // 내가 속한 길드일때만 길드원의 접속여부를 확인한다.
                    _MemberLogOffObj.SetActive(true);
                }
                else
                {
                    _MemberLogOffObj.SetActive(false);
                }

                System.TimeSpan timeresult = TimeManager.Instance.GetServerTime() - m_MemberInfo.kLastLogonTime.GetDateTime();
                if (timeresult.Days > 0)
                {
                    // 6589    {0} 일 전.
                    m_LastConnectLabel.text = string.Format(StringTableManager.GetData(6589), timeresult.Days);
                }
                else if (timeresult.Hours > 0)
                {
                    // 6590    {0} 시간 전.
                    m_LastConnectLabel.text = string.Format(StringTableManager.GetData(6590), timeresult.Hours);
                }
                else
                {
                    // 6591    {0} 시간 미만.
                    m_LastConnectLabel.text = string.Format(StringTableManager.GetData(6591), "1");
                }
            }
        }

        if (m_MemberInfo.kMemberState == _enGuildMemberState.eGuildMemberState_Captain)
        {
            m_CaptainCrown.gameObject.SetActive(true);
        }
        else if (m_MemberInfo.kMemberState == _enGuildMemberState.eGuildMemberState_SubCaptain || m_MemberInfo.kMemberState == _enGuildMemberState.eGuildMemberState_AbleSubCaptain)
        {
            m_SubCaptainCrown.gameObject.SetActive(true);
        }

        bool IsMine = false;        // 내 캐릭인지

        if (m_MemberInfo.kCharNo == UserInfo.Instance.CharNo)
        {
            m_BgMeSprite.gameObject.SetActive(true);
            IsMine = true;
        }

        SetButton(type, m_MemberInfo.kMemberState, IsMine);
    }
Exemple #20
0
        protected override IEnumerator SendCardAnimation(OnSendCardEventData cardData)
        {
            int cont = GameConfig.UserHandCardCnt * UtilData.CurrGamePalyerCnt;

            if (!GameConfig.IsNeedSendCardAnimation)
            {
                //不需要发牌动画时 直接设置手牌
                WallMj[_getMahjongChair].PopMahjong(cont);
                int[] nomalCards = new int[GameConfig.UserHandCardCnt];
                int   startChair = cardData.currChair;
                for (int i = 0; i < UtilData.CurrGamePalyerCnt; i++)
                {
                    HardMj[startChair].GetInMahjong(startChair == 0 ? cardData.playermj : nomalCards);
                    startChair = UtilFunc.GetNextChair(startChair, UtilData.CurrGamePalyerCnt);
                }
                cardData.reduceMjCnt(cont);
                yield return(0);
            }
            else
            {
                int startChair = cardData.currChair;

                int meOffset = 0;
                int jj       = 1;
                while (cont > 0)
                {
                    int   getInCnt = 4;
                    int[] card     = new int[getInCnt];

                    WallMj[_getMahjongChair].PopMahjong(getInCnt);
                    if (startChair == 0)
                    {
                        for (int i = 0; i < card.Length; i++)
                        {
                            card[i] = cardData.playermj[meOffset + i];
                        }
                        meOffset += card.Length;
                    }
                    else
                    {
                        for (int i = 0; i < card.Length; i++)
                        {
                            card[i] = 0;
                        }
                    }

                    if (startChair == 0)
                    {
                        HardMj[startChair].OnSendMahjongForJp(card, GameConfig.SendCardUpTime, GameConfig.SendCardUpWait,
                                                              cardData.laizi);
                    }
                    else
                    {
                        HardMj[startChair].OnSendMahjong(card, GameConfig.SendCardUpTime, GameConfig.SendCardUpWait);
                    }

                    cardData.reduceMjCnt(getInCnt);

                    yield return(new WaitForSeconds(GameConfig.SendCardInterval));

                    cont      -= getInCnt;
                    startChair = UtilFunc.GetNextChair(startChair, UtilData.CurrGamePalyerCnt);
                }

                yield return(new WaitForSeconds(GameConfig.SendCardUpTime + GameConfig.SendCardUpWait));
            }

            //发牌以后检索一遍自己手牌有没有漏掉的财神
            CheckCaishenBug();
        }
Exemple #21
0
 private void UpdateGameTimer(long timeLeft)
 {
     _gameTimeLeft   = timeLeft;
     _timerText.text = UtilFunc.FormatSecondsToMinutes((int)_gameTimeLeft);
 }
Exemple #22
0
        private static void Main(string[] args)
        {
            #region 获取参数

            string secret       = ConfigurationManager.AppSettings["secret"];
            string key          = ConfigurationManager.AppSettings["key"];
            double usdtLimit    = double.Parse(ConfigurationManager.AppSettings["usdtLimit"]);
            Symbol targetSymbol = UtilFunc.FormtStr(ConfigurationManager.AppSettings["targetSymbol"]);
            Console.WriteLine("Target Symbol:" + ConfigurationManager.AppSettings["targetSymbol"]);
            TimeSpan orderHolder = TimeSpan.FromMinutes(3);

            #endregion 获取参数

            FcoinClient fcilent = new FcoinClient(key, secret);

            List <BalanceInfo> balanceList = new List <BalanceInfo>();
            using (AppDbContext db = new AppDbContext())
            {
                //数据铺地
                //判断是否有订单存在

                //SuperTrade superTrade = null;
                //if (orderInfo == null)
                //{
                //    orderInfo = new TARGET_ORDER()
                //    {
                //        BaseCur = targetSymbol.BaseCurr,
                //        SwapCur = targetSymbol.SwapCurr
                //    };
                //    //List<SuperTrade> targetList = getTarget();
                //    //superTrade = targetList.Where(m => m.SymbolCurr.BaseCurr.ToUpper() == "USDT").OrderBy(m => (m.Reward / (m.DiffData == double.NaN ? 1 : m.DiffData))).FirstOrDefault();
                //    //orderInfo = new TARGET_ORDER()
                //    //{
                //    //    BaseCur = superTrade.SymbolCurr.BaseCurr,
                //    //    SwapCur = superTrade.SymbolCurr.SwapCurr,
                //    //};
                //}

                //订阅行情

                WebSocketUtil webSocketUtil = new WebSocketUtil();

                //服务器时差
                TimeSpan timeSpan = TimeSpan.Zero;
                webSocketUtil.connect(" wss://exchange.ifukang.com/api/web/ws", (string res) =>
                {
                    dynamic data = JsonConvert.DeserializeObject(res);
                    DateTime dt  = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

                    if (data != null && data.ts != null && data.bids == null)
                    {
                        long wsTicks = dt.Ticks + (long)data.ts * 10000;
                        timeSpan     = DateTime.UtcNow - (new DateTime(wsTicks));
                        Console.WriteLine("server time - fcoin time =" + timeSpan.TotalSeconds + "s");
                    }

                    if (data == null || data.bids == null)
                    {
                        Console.WriteLine("ws data error " + res);
                        return;
                    }
                    //计算时间戳,跳过旧行情数据
                    long tt             = dt.Ticks + (long)data.ts * 10000;
                    DateTime wsDatetime = new DateTime(tt);
                    if (Math.Abs((DateTime.UtcNow - wsDatetime).TotalSeconds) > Math.Abs(timeSpan.TotalSeconds) + 10)
                    {
                        Console.WriteLine("ws time old ,do nothing now: " + (DateTime.UtcNow + TimeSpan.FromHours(8)).ToString("yyyy-MM-dd HH:mm:ss") + " ws time: " + (wsDatetime + TimeSpan.FromHours(8)).ToString("yyyy-MM-dd HH:mm:ss"));
                        return;
                    }

                    TARGET_ORDER orderInfo = db.TARGET_ORDER.Where(m => m.Completed != "1" && m.BaseCur == targetSymbol.BaseCurr && m.SwapCur == targetSymbol.SwapCurr).OrderByDescending(m => m.Id).FirstOrDefault();


                    if (orderInfo == null)
                    {
                        //还未交易过
                        var balanceListResp = fcilent.GetBalanceList();
                        balanceList         = balanceListResp.data;
                        double usdtAmount   = double.Parse(balanceList.Where(m => m.currency.ToUpper() == "USDT").FirstOrDefault().available);
                        usdtAmount          = usdtAmount < usdtLimit ? usdtAmount : usdtLimit;
                        if (usdtAmount < 50)
                        {
                            Console.WriteLine("usdt small  than 200");
                            return;
                        }
                        double buyPrice = data.bids[6].Value;

                        MakeOrderParam makeOrderParam = new MakeOrderParam()
                        {
                            amount = ((usdtAmount / buyPrice) * 0.99).ToString(),
                            price  = buyPrice.ToString(),
                            side   = "buy",
                            symbol = (targetSymbol.SwapCurr + targetSymbol.BaseCurr).ToLower()
                        };

                        Console.WriteLine("make order " + JsonConvert.SerializeObject(makeOrderParam));

                        FcoinResponse <string> makerOrderResp = fcilent.MakerOrder(makeOrderParam);
                        Console.WriteLine("make order result " + JsonConvert.SerializeObject(makerOrderResp));
                        if (makerOrderResp.status == "0")
                        {
                            orderInfo = new TARGET_ORDER()
                            {
                                OrderId    = makerOrderResp.data,
                                Price      = buyPrice,
                                Completed  = "0",
                                BaseCur    = targetSymbol.BaseCurr,
                                SwapCur    = targetSymbol.SwapCurr,
                                CreateTime = DateTime.Now
                            };
                            db.TARGET_ORDER.Add(orderInfo);
                            db.SaveChanges();
                        }
                    }
                    else if (orderInfo.Completed == "0")
                    {
                        //判断订单状态
                        var orderInfoRes = fcilent.GetOrderDetail(orderInfo.OrderId);
                        if (orderInfoRes.status == "0" && orderInfoRes.data.state == "filled")
                        {
                            //若成交则卖出
                            OrderInfo buyOrderInfo = orderInfoRes.data;
                            Console.WriteLine("order filled ,make order to sell ");
                            double sellPrice = double.Parse(buyOrderInfo.price) * 1.005;
                            MakeOrderParam makeOrderParam = new MakeOrderParam()
                            {
                                amount = buyOrderInfo.filled_amount,
                                price  = sellPrice.ToString(),
                                side   = "sell",
                                symbol = (targetSymbol.SwapCurr + targetSymbol.BaseCurr).ToLower()
                            };
                            Console.WriteLine("make order " + JsonConvert.SerializeObject(makeOrderParam));

                            FcoinResponse <string> makerOrderResp = fcilent.MakerOrder(makeOrderParam);
                            Console.WriteLine("make order result " + JsonConvert.SerializeObject(makerOrderResp));
                            if (makerOrderResp.status == "0")
                            {
                                orderInfo.SellOrderId = makerOrderResp.data;
                                orderInfo.Completed   = "2";
                                orderInfo.SwapAmount  = double.Parse(buyOrderInfo.amount);
                                db.SaveChanges();
                            }
                            return;
                        }
                        else if (orderInfoRes.status == "0" && orderInfoRes.data.state == "submitted")
                        {
                            //若未成交且价格浮动,则取消订单
                            if (data.bids[2].Value < orderInfo.Price || orderInfo.Price < data.bids[20].Value)
                            {
                                //判断持单时长
                                if (DateTime.Now - orderInfo.CreateTime < orderHolder)
                                {
                                    Console.WriteLine("order holder wait time to  " + ((orderInfo.CreateTime + orderHolder).ToUniversalTime() + TimeSpan.FromHours(8)).ToString("yyyy-MM-dd HH:mm:ss"));
                                }
                                Console.WriteLine("price change ,cancle order ");
                                var cancleResult    = fcilent.CancleOrder(orderInfo.OrderId);
                                orderInfo.Completed = "1";
                                db.SaveChanges();
                            }
                        }
                    }
                    else if (orderInfo.Completed == "2")
                    {
                        //判断订单状态
                        var orderInfoRes        = fcilent.GetOrderDetail(orderInfo.SellOrderId);
                        OrderInfo sellOrderInfo = orderInfoRes.data;

                        if (orderInfoRes.status == "0" && orderInfoRes.data.state == "filled")
                        {
                            //若成交则置为完成
                            orderInfo.Completed = "1";
                            //等待三分钟,防止追高
                            db.SaveChanges();
                            System.Threading.Thread.Sleep(TimeSpan.FromMinutes(3));
                            //关闭,等待自动重连
                            webSocketUtil.close();
                            return;
                        }
                        else if (orderInfoRes.status == "0" && orderInfoRes.data.state == "submitted")
                        {
                            //判断损失是否超过5%,有则卖出止损
                            if (data.bids[0].Value / orderInfo.Price < 0.95)
                            {
                                //取消卖单

                                Console.WriteLine("value loss , sell");
                                double sellPrce = data.bids[0].Value / 2;
                                MakeOrderParam makeOrderParam = new MakeOrderParam()
                                {
                                    amount = orderInfo.SwapAmount.ToString(),
                                    price  = sellPrce.ToString(),
                                    side   = "sell",
                                    symbol = (orderInfo.SwapCur + orderInfo.BaseCur).ToLower()
                                };
                                Console.WriteLine("make order " + JsonConvert.SerializeObject(makeOrderParam));
                                FcoinResponse <string> makerOrderResp = fcilent.MakerOrder(makeOrderParam);
                                Console.WriteLine("make order result " + JsonConvert.SerializeObject(makerOrderResp));
                                orderInfo.Completed = "1";
                                db.SaveChanges();
                            }
                        }
                    }
                }, new List <Dictionary <string, object> >()
                {
                    new Dictionary <string, object>()
                    {
                        { "args", new List <string> {
                              "depth.L20." + targetSymbol.SwapCurr.ToLower() + targetSymbol.BaseCurr.ToLower()
                          } },
                        { "cmd", "sub" }
                    }
                }, 10).Wait();
            }
        }
Exemple #23
0
        public override void SetShowInfo(TableData table, Texture[] defineArray)
        {
            ShareScoreUiGob.SetActive(false);
            ShareLianZhuangUiGob.SetActive(false);
            ShareFlowerUiGob.SetActive(false);
            Btns.SetActive(false);
            foreach (var ewgob in ErweiGobs)
            {
                ewgob.SetActive(false);
            }
            BackToHallBtn.SetActive(table.RoomInfo.RoomType == EnRoomType.YuLe);

            gameObject.SetActive(true);

            MahjongManager.Instance.Reset();

            if (RoomID != null)
            {
                RoomID.text = table.RoomInfo.RoomID + "";
            }
            if (RoundImg != null)
            {
                RoundImg.sprite = table.RoomInfo.GameLoopType == EnGameLoopType.round ? JuImg : QuanImg;
            }
            if (Round != null)
            {
                Round.text = table.RoomInfo.CurrRound + "/" + table.RoomInfo.MaxRound;
            }

            foreach (OnRoudResultItem item in Items)
            {
                item.SetVisible = false;
            }

            var seatList = new List <int>();

            for (int i = 0; i < UtilData.CurrGamePalyerCnt; i++)
            {
                seatList.Add(i);
            }
            //根据胡牌玩家排序
            seatList.Sort((a, b) =>
            {
                bool isAHu = table.Result.HuSeat.Contains(a);
                bool isBHu = table.Result.HuSeat.Contains(b);
                if (isAHu && !isBHu)
                {
                    return(-1);
                }

                if (!isAHu && isBHu)
                {
                    return(1);
                }

                if (isAHu && isBHu)
                {
                    int aScore = table.Result.HuGold[a];
                    int bScore = table.Result.HuGold[b];

                    if (aScore < bScore)
                    {
                        return(-1);
                    }
                    if (aScore > bScore)
                    {
                        return(1);
                    }
                }

                return(0);
            });

            UtilFunc.OutPutList(seatList, "游戏结束 玩家胡牌排序后");
            if (BaoArea != null)
            {
                int bao = table.Result.bao;

                if (bao > 0)
                {
                    GameObject baoItem = D2MahjongMng.Instance.GetMj(bao, EnD2MjType.Up, bao);
                    baoItem.transform.parent        = BaoArea;
                    baoItem.transform.localPosition = Vector3.zero;
                    baoItem.transform.localScale    = Vector3.one;
                }
            }
            //是否赢
            bool isMeWin = table.Result.HuSeat.Contains(table.PlayerSeat);
            //是否流局
            bool isLiuJu = table.Result.HuType == MjRequestData.MJReqTypeLastCd;

            int huCnt = 1;

            for (int i = 0; i < seatList.Count; i++)
            {
                int seat = seatList[i];
                Items[i].SetVisible = true;
                Items[i].Name       = table.UserDatas[seat].name;


                var hunameInfo = table.Result.HuName[seat];


                Items[i].StrHuInfo    = hunameInfo;
                Items[i].IntHuScore   = table.Result.HuGold[seat];
                Items[i].IntGangScore = table.Result.GangGlod[seat];
                Items[i].IntScore     = table.Result.Gold[seat];
                Items[i].IsHu         = false;
                Items[i].IsBanker     = seat == table.BankerSeat;
                // 码分
                Items[i].SetNiaoScore = table.Result.NiaoGold[seat];
                //吃碰杠加入
                Items[i].SetCpgCardJp(table.UserCpg[seat], table.Laizi);
                Items[i].SetHardCard(table.UserHardCard[seat].ToArray(), table.Laizi);

                bool ishu = false;
                //设置胡牌信息
                if (huCnt++ <= table.Result.HuSeat.Count)
                {
                    ishu          = true;
                    Items[i].IsHu = true;
                    Items[i].SetHardCard(new[] { table.Result.HuCard }, table.Laizi);
                }

                Items[i].SortCardGroup();

                Items[i].HuTypeValue = table.Result.UserHuType[seat];

                Items[i].SetHeadImg(table.UserDatas[seat].HeadImage, defineArray[table.UserDatas[seat].Sex % 2]);

                if (OnerdExtraMsgItems[i] != null)
                {
                    var bgimg = OnerdExtraMsgItems[i].GetComponent <Image>();
                    if (bgimg != null)
                    {
                        if (!isLiuJu)
                        {
                            bgimg.sprite = isMeWin ? WinbgImg : LosebgImg;
                        }
                        else
                        {
                            bgimg.sprite = HebgImg;
                        }
                    }

                    var buzhangList = new int[] {};
                    var buzhangLen  = table.Result.BuZhangList.Count;
                    if (buzhangLen >= seat && buzhangLen > 0)
                    {
                        buzhangList = table.Result.BuZhangList[seat];
                    }
                    OnerdExtraMsgItems[i].SetExtraInfo(table.Result.Huaname[seat],
                                                       table.Result.Taicnt[seat], table.Result.Huacnt[seat], CheckLaiziGroup(table.UserHardCard[seat].ToArray(), table.Result.HuCard,
                                                                                                                             ishu, table.Laizi), buzhangList, table.Laizi,
                                                       table.Result.IsBaoPai[seat], table.Result.LianZhuangInfo[seat], table.Fanpai);
                }


                #region  添加分享信息
                var shareGoldScore = table.Result.ShareShowGold[seat];
                if (seat == table.PlayerSeat)
                {
                    var jptabledata = table as JpTableData;

                    if (jptabledata != null)
                    {
                        //胡了,且分数足够分享
                        var ishuAndShareScore = ishu && shareGoldScore >= jptabledata.ShareHuScoreValue;
                        //没胡,但花数足够分享
                        var nohuAndShareHua = !ishu && table.Result.Huacnt[seat] >= jptabledata.ShareHuHuaNumValue;
                        if (ishuAndShareScore || nohuAndShareHua)
                        {
                            ShareScoreUiGob.SetActive(true);

                            //分数信息
                            if (ishuAndShareScore)
                            {
                                SelfPlayerHuScoreText.text  = YxUtiles.GetShowNumber(shareGoldScore).ToString(CultureInfo.InvariantCulture) + "分";
                                SelfPlayerHuScoreText1.text = "总积分:" + YxUtiles.GetShowNumber(shareGoldScore).ToString(CultureInfo.InvariantCulture) + "分";
                                HurawImgBg.SetActive(true);
                                HuaShareRawImgBg.SetActive(false);
                            }
                            else if (nohuAndShareHua)
                            {
                                HuaNumtext.text  = "花:" + table.Result.Huacnt[seat];
                                HuaNumtext1.text = "花:" + table.Result.Huacnt[seat];
                                HurawImgBg.SetActive(false);
                                HuaShareRawImgBg.SetActive(true);
                            }


                            //头像信息
                            SetShareHeadImg(table.UserDatas[seat].HeadImage, ShareHeadImgScore,
                                            defineArray[table.UserDatas[seat].Sex % 2]);

                            //按钮
                            Btns.SetActive(true);



                            var cdinfoOnrditem = CardsInfoZone.GetComponent <OnRoudResultItem>();
                            cdinfoOnrditem.Cleare();
                            cdinfoOnrditem.SetCpgCardJp(table.UserCpg[seat], table.Laizi);
                            cdinfoOnrditem.SetHardCard(table.UserHardCard[seat].ToArray(), table.Laizi);
                            if (ishu)
                            {
                                cdinfoOnrditem.SetHardCard(new[] { table.Result.HuCard }, table.Laizi);
                            }
                            cdinfoOnrditem.SortCardGroup();

                            cdinfoOnrditem.StrHuInfo = hunameInfo;

                            var onrdextramessage = CardsInfoZone.GetComponent <OneRdExtraMessShow>();
                            onrdextramessage.SetExtraInfo(table.Result.Huaname[seat],
                                                          table.Result.Taicnt[seat], table.Result.Huacnt[seat], CheckLaiziGroup(table.UserHardCard[seat].ToArray(), table.Result.HuCard,
                                                                                                                                ishu, table.Laizi), table.Result.BuZhangList[seat], table.Laizi,
                                                          table.Result.IsBaoPai[seat], table.Result.LianZhuangInfo[seat], table.Fanpai);
                            onrdextramessage.SetEstraCds();
                        }
                        else if (table.Result.LianZhuangNumInfo[seat] >= jptabledata.LianzhuangNum)
                        {
                            //连庄数信息
                            SelfPlayerlianzhuangZhuangText.text = table.Result.LianZhuangNumInfo[seat].ToString(CultureInfo.InvariantCulture);
                            //连庄信息
                            SelfPlayerlianzhuanInfoText.text = table.Result.LianZhuangInfo[seat];

                            ShareLianZhuangUiGob.SetActive(true);

                            SetShareHeadImg(table.UserDatas[seat].HeadImage, ShareHeadImgLianzhuang,
                                            defineArray[table.UserDatas[seat].Sex % 2]);

                            Btns.SetActive(true);
                        }
                    }
                }
                #endregion
            }

            if (UtilData.RoomType == EnRoomType.YuLe)
            {
                _startCall = () =>
                {
                    Hide();
                    EventDispatch.Dispatch((int)NetEventId.OnGameRestart, new EventData());
                };
            }

            if (isMeWin)
            {
                if (Gril != null)
                {
                    Gril.sprite = GrilWin;
                }
                if (Result != null)
                {
                    Result.sprite = WinSpr;
                }
            }
            else
            {
                if (Gril != null)
                {
                    Gril.sprite = GrilLost;
                }
                if (Result != null)
                {
                    Result.sprite = LostSpr;
                }
            }

            if (isLiuJu) //流局
            {
                if (Result != null)
                {
                    Result.sprite = HeSpr;
                }
            }

            if (_laterUnfoldCor != null)
            {
                StopCoroutine(_laterUnfoldCor);
            }
            _laterUnfoldCor = StartCoroutine(LaterUnfoldingInfo());
        }
    private void SetDispatchInfo()
    {
        // 스테이지 조건 검사.
        {
            _ClearStage.SetActive(false);
            _ClearStageLabel.gameObject.SetActive(false);

            CUserGameStageInfo stagetInfo = UserInfo.Instance.UserGameStageInfo;

            if (stagetInfo.IsClearStage(m_DispatchTableData.RequireStage) == false)
            {
                UIEventListener.Get(gameObject).onClick = null;

                _ClearStage.SetActive(true);
                _ClearStageLabel.gameObject.SetActive(true);

                DATA_MAP_STAGE MapStageTableData = CDATA_MAP_STAGE.Get(m_DispatchTableData.RequireStage);
                if (MapStageTableData != null)
                {
                    int iAreaID  = UtilFunc.GetRegionIndex(MapStageTableData.m_iIndex);
                    int iStageID = UtilFunc.GetStageIndex(MapStageTableData.m_iIndex);
                    _ClearStageLabel.text = string.Format("{0} {1} - {2}", StringTableManager.GetData(MapStageTableData.iAreaName), iAreaID, iStageID + 1);
                }
            }
        }

        m_DispatchingObj.SetActive(false);

        // 6849	(최소 {0}인)
        string str = string.Format(StringTableManager.GetData(6849), m_DispatchTableData.RequireNumber);

        m_titleLabel.text = string.Format("{0} {1}", StringTableManager.GetData(int.Parse(m_DispatchTableData.String_Name)), str);

        // 6847    Lv {0} 이상 {1}성 이상
        m_ConditionLabel.text = string.Format(StringTableManager.GetData(6847), m_DispatchTableData.RequireLevel, (int)m_DispatchTableData.RequireGrade);

        int ihour    = m_DispatchTableData.RequireTime / 60;
        int iMinutes = m_DispatchTableData.RequireTime - (60 * ihour);

        if (ihour > 0)
        {
            // 6740	소요 시간 : {0}시간 {1}분
            m_TimeLabel.text = string.Format(StringTableManager.GetData(6740), ihour, iMinutes);
        }
        else
        {
            // 6741	소요 시간 : {0}분
            m_TimeLabel.text = string.Format(StringTableManager.GetData(6741), iMinutes);
        }

        Dictionary <int, DATA_REWARD_NEW> RewardData = CDATA_REWARD_NEW.Get(m_DispatchTableData.RewardItemEnum);

        if (RewardData == null)
        {
            return;     // error.
        }
        foreach (KeyValuePair <int, DATA_REWARD_NEW> data in RewardData)
        {
            DATA_ITEM_NEW item = CDATA_ITEM_NEW.Get(data.Value.RewardValue);
            if (item == null)
            {
                continue;
            }

            m_RewardSprite.sprite2D = UIResourceMgr.CreateSprite(BUNDLELIST.TEXTURE_ICON_ITEMICON, item.m_szIconName);
            m_RewardLabel.text      = data.Value.RewardCount.ToString();
        }

        //m_RewardSprite.spriteName
        //m_RewardLabel.text = m_DispatchTableData.QuickCost.ToString();

        _stDispatchInfoAck stDispatchInfoAck = UserInfo.Instance.DispatchInfoAck;

        if (stDispatchInfoAck == null)
        {
            return;     // error.
        }
        int iCount = stDispatchInfoAck.vDispatch.Count;

        for (int i = 0; i < iCount; ++i)
        {
            CDispatch dispatch = stDispatchInfoAck.vDispatch[i];
            if (dispatch == null)
            {
                continue;
            }

            if (dispatch.kDispatchState == _enDispatchState.eDispatchState_None)
            {
                continue;
            }

            if (m_DispatchTableData.DispatchCategory == dispatch.kMissionCategory && m_DispatchTableData.DispatchEnum == dispatch.kDispatchSubID)
            {
                UIEventListener.Get(gameObject).onClick = null;
                m_DispatchingObj.SetActive(true);

                DateTime kEndTime     = dispatch.kEndTime.GetDateTime();
                DateTime kCurrentTime = TimeManager.Instance.GetServerTime();
                TimeSpan timeresult   = kEndTime - kCurrentTime;

                if (kCurrentTime.Ticks >= kEndTime.Ticks)       // 임무완료.
                {
                    m_DispatchingGageSprtie.fillAmount = 1;

                    m_DispatchingGageLabel.text  = StringTableManager.GetData(3395);        // 3395	완료.
                    m_DispatchingTitleLabel.text = StringTableManager.GetData(6848);        // 6848	임무 완료.
                }
                else
                {
                    m_DispatchingTitleLabel.text = StringTableManager.GetData(6742);            // 6742	임무 수행 중

                    m_DispatchingGageSprtie.fillAmount = 1 - (float)(timeresult.TotalSeconds / (m_DispatchTableData.RequireTime * 60));

                    if (timeresult.Hours > 0)
                    {
                        // 4915	{0}시간 {1}분 남음
                        m_DispatchingGageLabel.text = string.Format(StringTableManager.GetData(4915), timeresult.Hours, timeresult.Minutes);
                    }
                    else if (timeresult.Minutes > 0)
                    {
                        // 4916	{0}분 남음
                        m_DispatchingGageLabel.text = string.Format(StringTableManager.GetData(4916), timeresult.Minutes);
                    }
                    else if (timeresult.Seconds > 0)
                    {
                        // 4959	1분 미만
                        m_DispatchingGageLabel.text = StringTableManager.GetData(4959);
                    }
                }
            }
        }
    }
Exemple #25
0
    public void Generate()
    {
        var container = mapMeshData.mapMeshData;

        obstacles = container.obstacles;
        upBound   = container.upBound;
        downBound = container.downBound;
        pointObj  = container.pointObj;
        //Check if MapBaker object already exists
        if (FindObjectOfType <MapBaker>() != null)
        {
            Debug.LogError("MapBaker already exists in the scene!");
            return;
        }

        //Create MapBaker Object
        MapBaker mb = new GameObject().AddComponent <MapBaker>();

        //Calculate Bounds points:
        #region CALCULATE BOUNDS POITNS
        #region UPPER LEFT CORNER
        float   x2    = upBound.localScale.x / 2f;
        float   y2    = upBound.localScale.y / 2f;
        Vector2 point = upBound.position - new Vector3(x2, y2, 0f);
        point            += new Vector2(upBound.localScale.y, -upBound.localScale.y);
        boundaryPoints[0] = point;
        #endregion
        #region UPPER RIGHT CORNER
        point             = upBound.position + new Vector3(x2, y2, 0f);
        point            += new Vector2(-upBound.localScale.y, -upBound.localScale.y);
        boundaryPoints[1] = point;
        #endregion
        #region LOWER LEFT CORNER
        x2                = downBound.localScale.x / 2f;
        y2                = downBound.localScale.y / 2f;
        point             = upBound.position - new Vector3(x2, y2, 0f);
        point            += new Vector2(upBound.localScale.y, upBound.localScale.y);
        boundaryPoints[2] = point;
        #endregion
        #region LOWER RIGHT CORNER
        x2                = downBound.localScale.x / 2f;
        y2                = downBound.localScale.y / 2f;
        point             = upBound.position + new Vector3(x2, y2, 0f);
        point            += new Vector2(-upBound.localScale.y, upBound.localScale.y);
        boundaryPoints[3] = point;
        #endregion
        #endregion
        List <Vector2> leftUpperPoints  = new List <Vector2>();
        List <Vector2> rightUpperPoints = new List <Vector2>();
        List <Vector2> leftLowerPoints  = new List <Vector2>();
        List <Vector2> rightLowerPoints = new List <Vector2>();
        foreach (var box in obstacles)
        {
            Vector3 halfScale        = box.localScale / 2f;
            Vector2 leftUpperCorner  = box.position + new Vector3(-halfScale.x, halfScale.y);
            Vector2 rightUpperCorner = box.position + halfScale;
            Vector2 leftLowerCorner  = box.position - halfScale;
            Vector2 rightLowerCorner = box.position + new Vector3(halfScale.x, -halfScale.y);
            leftLowerPoints.Add(leftLowerCorner);
            leftUpperPoints.Add(leftUpperCorner);
            rightUpperPoints.Add(rightUpperCorner);
            rightLowerPoints.Add(rightLowerCorner);
        }
        List <MeshRay> rays = new List <MeshRay>();
        foreach (Vector2 P in leftLowerPoints)
        {
            rays.Add(new MeshRay(P, Direction4.LEFT));
            rays.Add(new MeshRay(P, Direction4.DOWN));
        }
        foreach (Vector2 P in leftUpperPoints)
        {
            rays.Add(new MeshRay(P, Direction4.LEFT));
            rays.Add(new MeshRay(P, Direction4.UP));
        }
        foreach (Vector2 P in rightUpperPoints)
        {
            rays.Add(new MeshRay(P, Direction4.RIGHT));
            rays.Add(new MeshRay(P, Direction4.UP));
        }
        foreach (Vector2 P in rightLowerPoints)
        {
            rays.Add(new MeshRay(P, Direction4.RIGHT));
            rays.Add(new MeshRay(P, Direction4.DOWN));
        }

        List <Vector2> intersections = new List <Vector2>();
        foreach (var ray in rays)
        {
            Debug.DrawRay(ray.point, UtilFunc.Direction4ToVector2(ray.direction), Color.green, 30f);
        }
        foreach (var ray in rays)
        {
            var hit  = Physics2D.Raycast(ray.point, UtilFunc.Direction4ToVector2(ray.direction));
            var hits = Physics2D.RaycastAll(ray.point, UtilFunc.Direction4ToVector2(ray.direction));
            if (hits.Length >= 2)
            {
                intersections.Add(hits[1].point);
                intersections.Add(hits[0].point);
            }
            else if (hits.Length > 0)
            {
                intersections.Add(hits[0].point);
            }
        }
        GameObject parent = new GameObject();
        foreach (var intersection in intersections)
        {
            GameObject g = Instantiate(pointObj, parent.transform);
            g.transform.position = intersection;
        }

        //Rays create a grid
        //Sort Rays y x,
    }
Exemple #26
0
    private void SetGoddnessData(DATA_GUILD_MAIN._enGuildLv kGuildLevel)
    {
        _DisplayGuildLv = kGuildLevel;
        _GuildMainData  = CDATA_GUILD_MAIN.Get(_DisplayGuildLv);
        if (_GuildMainData == null)
        {
            return;     // error
        }
        int GuildLevel = _GuildMainData.iGuildLv;

        _GuildLevelTitleLabel.text = string.Format(StringTableManager.GetData(8288), GuildLevel);      // 8288    Lv.{0} 길드 봉헌

        for (int i = 0; i < _GuildGoddnessTextList.Count; ++i)
        {
            DestroyImmediate(_GuildGoddnessTextList[i].gameObject);
        }
        _GuildGoddnessTextList.Clear();

        // Free
        TributeData tributeData = SetTributeText(_GuildMainData.enTributeFree, _FreeTributeGrid.transform);

        if (tributeData != null)
        {
            // 6900	{0}단계 여신의 숨결
            _FreeGoddnessTitleLabel.text   = string.Format(StringTableManager.GetData(6900), GuildLevel);
            _FreeGoddness2DSprite.sprite2D = tributeData._GoddnessSprite;
            _FreeTributeButtonLabel.text   = tributeData._TributeButtonText;
        }

        // Good
        tributeData = SetTributeText(_GuildMainData.enTributeGood, _GoodTributeGrid.transform);
        if (tributeData != null)
        {
            // 6901	{0}단계 눈부신 여신의 가호
            _GoodGoddnessTitleLabel.text    = string.Format(StringTableManager.GetData(6901), GuildLevel);
            _GoodGoddness2DSprite.sprite2D  = tributeData._GoddnessSprite;
            _GoodTributeButtonLabel.text    = tributeData._TributeButtonText;
            _GoodTributePriceTypeLabel.text = tributeData._Price.ToString();

            _GoodTributePriceTypeSprite.spriteName = UtilFunc.GetWealthIconName(tributeData._PriceType);
        }

        // Extra
        tributeData = SetTributeText(_GuildMainData.enTributeExtra, _ExtraTributeGrid.transform);
        if (tributeData != null)
        {
            // 6902	{0}단계 성스러운 여신의 축복
            _ExtraGoddnessTitleLabel.text    = string.Format(StringTableManager.GetData(6902), GuildLevel);
            _ExtraGoddness2DSprite.sprite2D  = tributeData._GoddnessSprite;
            _ExtraTributeButtonLabel.text    = tributeData._TributeButtonText;
            _ExtraTributePriceTypeLabel.text = tributeData._Price.ToString();

            _ExtraTributePriceTypeSprite.spriteName = UtilFunc.GetWealthIconName(tributeData._PriceType);
        }

        if (_MyGuildLv == kGuildLevel)
        {
            _FreeTributeButton.SetActive(true);
            _GoodTributeButton.SetActive(true);
            _ExtraTributeButton.SetActive(true);

            _BottomLevelMissMatchLabel.gameObject.SetActive(false);
        }
        else
        {
            _FreeTributeButton.SetActive(false);
            _GoodTributeButton.SetActive(false);
            _ExtraTributeButton.SetActive(false);

            _BottomLevelMissMatchLabel.gameObject.SetActive(true);
        }

        ResetPosition();
    }
Exemple #27
0
    private void CreateItemIcon(List <PvPItemInfo> items)
    {
        ClearItemIcon();

        for (int i = 0; i < items.Count; i++)
        {
            PvPItemInfo info = items[i];

            CItem citem = new CItem();
            citem.m_ItemID  = info.ItemID;
            citem.m_ItemKey = info.ItemKey;

            citem.m_ItemOptions = new _vItemOptions();

            for (int k = 0; k < info.options.Count; k++)
            {
                PvPItemOptionInfo optioninfo = info.options[k];

                CItemOption citemoption = new CItemOption();
                citemoption.m_OptionNo      = optioninfo.optionNo;
                citemoption.m_OptionID      = optioninfo.optionID;
                citemoption.m_OptionCreator = optioninfo.optionCreator;
                citemoption.m_OptionInt     = optioninfo.optionInt;
                citemoption.m_OptionBigint  = optioninfo.optionBigint;

                citem.m_ItemOptions.Add(citemoption);
            }

            DATA_ITEM_NEW itemTable = CDATA_ITEM_NEW.Get(info.ItemID);

            Transform parent = null;

            if (itemTable.m_enItemSubType == DATA_ITEM_SUB_TYPE_NEW._enItemStatusSubType.ITEMTYPE_EI_WEAPON)
            {
                parent = _itemIconTransforms[(int)enCreatureItemType.ITEMCREATUETYPE_WEAPON];
            }
            else if (itemTable.m_enItemSubType == DATA_ITEM_SUB_TYPE_NEW._enItemStatusSubType.ITEMTYPE_EI_ARMOR)
            {
                parent = _itemIconTransforms[(int)enCreatureItemType.ITEMCREATUETYPE_ARMOR];
            }
            else if (itemTable.m_enItemSubType == DATA_ITEM_SUB_TYPE_NEW._enItemStatusSubType.ITEMTYPE_EI_ACCESSORY)
            {
                parent = _itemIconTransforms[(int)enCreatureItemType.ITEMCREATUETYPE_ACC1];
            }
            else if (itemTable.m_enItemSubType == DATA_ITEM_SUB_TYPE_NEW._enItemStatusSubType.ITEMTYPE_EI_ACCESSORY_2)
            {
                parent = _itemIconTransforms[(int)enCreatureItemType.ITEMCREATUETYPE_ACC2];
            }

            ItemBaseIcon icon = UIResourceMgr.CreatePrefab <ItemBaseIcon>(BUNDLELIST.PREFABS_UI_COMMON, parent, "ItemBaseIcon");

            UIPanel iconPanel = icon.GetComponent <UIPanel>();
            if (iconPanel != null)
            {
                if (_panel != null)
                {
                    UtilFunc.SetPanelDepth(iconPanel, _panel.depth + 10);
                }
                else
                {
                    UtilFunc.SetPanelDepth(iconPanel, 410);
                }
            }

            TweenScale tweenscale = icon.GetComponent <TweenScale>();
            if (tweenscale != null)
            {
                DestroyImmediate(tweenscale);
            }

            uint ItemForce = info.ItemForce;

            ItemSlot slot = new ItemSlot(citem);
            slot.SetUpgradeLevel((int)ItemForce);

            icon.Init(itemTable, slot);
            icon.SetForceCount((int)ItemForce);
            icon.ActiveGoldBuffIcon(false);

            _itemIconList.Add(icon);
        }
    }
Exemple #28
0
        public virtual void SetShowInfo(TableData table, Texture[] defineArray)
        {
            gameObject.SetActive(true);

            if (RoomID != null)
            {
                RoomID.text = table.RoomInfo.RoomID + "";
            }
            if (RoundImg != null)
            {
                RoundImg.sprite = table.RoomInfo.GameLoopType == EnGameLoopType.round ? JuImg : QuanImg;
            }
            if (Round != null)
            {
                Round.text = table.RoomInfo.CurrRound + "/" + table.RoomInfo.MaxRound;
            }
            if (TimeData != null)
            {
                TimeData.text = DateTime.Now.ToString("yyyy年MM月dd日   HH:mm:ss");
            }
            foreach (OnRoudResultItem item in Items)
            {
                item.SetVisible = false;
                item.Chair      = -1;
            }

            var seatList = new List <int>();

            for (int i = 0; i < UtilData.CurrGamePalyerCnt; i++)
            {
                seatList.Add(i);
            }
            //根据胡牌玩家排序
            seatList.Sort((a, b) =>
            {
                bool isAHu = table.Result.HuSeat.Contains(a);
                bool isBHu = table.Result.HuSeat.Contains(b);
                if (isAHu && !isBHu)
                {
                    return(-1);
                }
                if (!isAHu && isBHu)
                {
                    return(1);
                }
                if (isAHu && isBHu)
                {
                    int aScore = table.Result.HuGold[a];
                    int bScore = table.Result.HuGold[b];
                    if (aScore < bScore)
                    {
                        return(-1);
                    }
                    if (aScore > bScore)
                    {
                        return(1);
                    }
                }
                return(0);
            });

            UtilFunc.OutPutList(seatList, "游戏结束 玩家胡牌排序后");
            if (BaoArea != null)
            {
                int bao = table.Result.bao;

                if (bao > 0)
                {
                    GameObject baoItem = D2MahjongMng.Instance.GetMj(bao, EnD2MjType.Up, bao);
                    baoItem.transform.parent        = BaoArea;
                    baoItem.transform.localPosition = Vector3.zero;
                    baoItem.transform.localScale    = Vector3.one;
                }
            }
            int huCnt = 1;

            for (int i = 0; i < seatList.Count; i++)
            {
                int seat = seatList[i];
                Items[i].SetVisible   = true;
                Items[i].Name         = table.UserDatas[seat].name;
                Items[i].UserID       = table.UserDatas[seat].id.ToString();
                Items[i].StrHuInfo    = table.Result.HuName[seat];
                Items[i].IntHuScore   = table.Result.HuGold[seat];
                Items[i].IntGangScore = table.Result.GangGlod[seat];
                Items[i].IntScore     = table.Result.Gold[seat];
                Items[i].IsHu         = false;
                Items[i].SetPiaoScore = table.Result.PiaoGlod[seat];
                Items[i].IsBanker     = seat == table.BankerSeat;
                // 码分
                Items[i].SetNiaoScore = table.Result.NiaoGold[seat];
                //吃碰杠加入
                Items[i].SetCpgCard(table.UserCpg[seat]);
                Items[i].SetHardCard(table.UserHardCard[seat].ToArray(), table.Laizi);
                //设置胡牌信息
                if (huCnt++ <= table.Result.HuSeat.Count)
                {
                    Items[i].IsHu = true;
                    Items[i].SetHardCard(new[] { table.Result.HuCard }, table.Laizi);
                }

                Items[i].SortCardGroup();

                Items[i].HuTypeValue = table.Result.UserHuType[seat];

                int sex = table.UserDatas[seat].Sex;
                sex = sex >= 0 ? sex : 0;
                Items[i].SetHeadImg(table.UserDatas[seat].HeadImage, defineArray[sex % 2]);
            }

            if (UtilData.RoomType == EnRoomType.YuLe)
            {
                _startCall = () =>
                {
                    Hide();
                    EventDispatch.Dispatch((int)NetEventId.OnGameRestart, new EventData());
                };
            }

            bool isMeWin = table.Result.HuSeat.Contains(table.PlayerSeat);

            if (isMeWin)
            {
                if (Gril != null)
                {
                    Gril.sprite = GrilWin;
                    Facade.Instance <MusicManager>().Play("win");
                    Gril.SetNativeSize();
                }
                if (Result != null)
                {
                    Result.sprite = WinSpr;
                }
            }
            else
            {
                if (Gril != null)
                {
                    Gril.sprite = GrilLost;
                    Facade.Instance <MusicManager>().Play("loss");
                    Gril.SetNativeSize();
                }
                if (Result != null)
                {
                    Result.sprite = LostSpr;
                }
            }

            if (table.Result.HuType == MjRequestData.MJReqTypeLastCd) //流局
            {
                if (Result != null)
                {
                    Result.sprite = HeSpr;
                }
            }
        }
Exemple #29
0
    //===================================================================================
    //
    // Method
    //
    //===================================================================================
    public void SetResultData(_stGuildRaidBattleResultAck resultData)
    {
        GuildRaidInfo guildRaidInfo = UserInfo.Instance.guildRaidInfo;

        DATA_GUILDRAID guildRaidTable = CDATA_GUILDRAID.Get(guildRaidInfo.guildRaidType);

        if (guildRaidTable == null)
        {
#if DEBUG_LOG
            Debug.Log(string.Format("<color=red> GUILDRAID Table Error - guildRaidType : {0} </color>", guildRaidInfo.guildRaidType));
#endif
            return;
        }

        _easyIconLabel.text  = StringTableManager.GetData(81);    // 81 쉬움
        _nomalIconLabel.text = StringTableManager.GetData(82);    // 82 보통
        _hardIconLabel.text  = StringTableManager.GetData(83);    // 83 어려움

        _easyIcon.gameObject.SetActive(false);
        _nomalIcon.gameObject.SetActive(false);
        _hardIcon.gameObject.SetActive(false);

        if (guildRaidTable.SetLevel == (int)enGuildRaidDifficulty.Easy)
        {
            _easyIcon.gameObject.SetActive(true);
        }
        else if (guildRaidTable.SetLevel == (int)enGuildRaidDifficulty.Normal)
        {
            _nomalIcon.gameObject.SetActive(true);
        }
        else if (guildRaidTable.SetLevel == (int)enGuildRaidDifficulty.Hard)
        {
            _hardIcon.gameObject.SetActive(true);
        }

        //_bossLevel.gameObject.SetActive(false);   // 레벨없음

        _bossBannerSprite.sprite2D    = UIResourceMgr.CreateSprite(BUNDLELIST.TEXTURE_GUILDRAID, guildRaidTable.RaidBannerImage);
        _titleLabel.text              = StringTableManager.GetData(6753); // 6753	길드 레이드
        _bossName.text                = StringTableManager.GetData(guildRaidTable.RaidBossName);
        _currentScore.text            = string.Format(StringTableManager.GetData(3411), 0);
        _totalScore.text              = string.Format(StringTableManager.GetData(3411), UtilFunc.CurrencyFormat((int)(guildRaidInfo.guildRaidScore + resultData.kAddScore)));
        _moveMainMenuButtonLabel.text = StringTableManager.GetData(133);
        _moveGuildRaidLabel.text      = StringTableManager.GetData(6753);   // 6753	길드 레이드
        _moveGuildRaidReadyLabel.text = StringTableManager.GetData(135);
        _guildRaidTicketLabel.text    = string.Format(StringTableManager.GetData(4918), resultData.kUpdatePlayCount);

        if (UserInfo.Instance.GuildRaidTicket < 1)
        {
            Vector3 OriginPos = _moveMainMenuButton.transform.localPosition;
            _moveMainMenuButton.transform.localPosition = new Vector3(-150.0f, OriginPos.y, OriginPos.z);

            OriginPos = _moveGuildRaid.transform.localPosition;
            _moveGuildRaid.transform.localPosition = new Vector3(150.0f, OriginPos.y, OriginPos.z);

            _moveGuildRaidReady.gameObject.SetActive(false);
        }

        // ulog -> float -> (ulog or int) 손실발생. 그래서 저장.
        float Round = Mathf.Round(resultData.kAddScore); // ulong -> float
        _roundToInt = Mathf.RoundToInt(Round);           // float -> int

        _score = resultData.kAddScore;

        // iTween.ValueTo 호출 시 (int)iCurrScore 이 값을 Hash에서 float으로 저장할때 손실발생.
        iTween.ValueTo(gameObject, iTween.Hash("from", 0, "to", (int)_score, "onUpdate", "CurrScoreCounter", "delay", 1, "time", 1));
    }