Exemplo n.º 1
0
    private void OnChangeToDie(params object[] pArgs)
    {
        InitPhysicsValue();
        StopMoveTween();

        var pStick    = (SHUIWidget_Stick)pArgs[0];
        var eCrashDir = Single.Balance.GetDirection(pStick, this);

        PlayAnim(eDirection.Front, gameObject, (eDirection.Left == eCrashDir) ?
                 m_pDie_Left : m_pDie_Right, null);

        var eAccuracy  = Single.Balance.GetDecision(pStick, this);
        var iBonusCoin = GetBonusCoin(eAccuracy);

        SHUtils.For(0, iBonusCoin, (iIndex) =>
        {
            var pHUD = Single.UI.GetPanel <SHUIPanel_HUD>("Panel_HUD");
            Single.Damage.AddDamage("Dmg_Coin", new SHAddDamageParam(this, pHUD.GetCoinTarget(), null, null));
        });

        if ((0 != iBonusCoin) && (eDecision.Good == eAccuracy))
        {
            PlayParticle("Particle_Crash_Dust_Big");
        }
        else
        {
            PlayParticle("Particle_Crash_Dust_Small");
        }

        m_fSpeed        = m_pInfo.m_vDieSpeed.magnitude;
        m_vDirection    = m_pInfo.m_vDieSpeed.normalized;
        m_vDirection.x  = (eDirection.Left == eCrashDir) ? -m_vDirection.x : m_vDirection.x;
        m_vDirection.x *= SHMath.Random(0.0f, 2.0f);
    }
    public override bool?LoadJsonTable(JSONNode pJson, string strFileName)
    {
        if (null == pJson)
        {
            return(false);
        }

        SHUtils.For(0, pJson["PreLoadResourcesList"].Count, (iLoop) =>
        {
            var pDataNode = pJson["PreLoadResourcesList"][iLoop];
            SHUtils.ForToEnum <eSceneType>((eType) =>
            {
                SHUtils.For(0, pDataNode[eType.ToString()].Count, (iDataIndex) =>
                {
                    AddData(eType, pDataNode[eType.ToString()][iDataIndex].Value);
                });
            });
        });

        return(true);
    }
Exemplo n.º 3
0
    // 인터페이스 : DataSet을 Json으로 쓰기
    public void Write(string strFileName, Dictionary <string, List <SHTableDataSet> > dicData)
    {
        #if UNITY_EDITOR
        if (null == dicData)
        {
            Debug.LogError(string.Format("Json으로 저장할 데이터가 없습니다!!"));
            return;
        }

        string strNewLine = "\r\n";
        string strBuff    = "{" + strNewLine;
        SHUtils.ForToDic(dicData, (pKey, pValue) =>
        {
            strBuff += string.Format("\t\"{0}\": [{1}", pKey, strNewLine);
            SHUtils.ForToList(pValue, (pData) =>
            {
                strBuff += "\t\t{" + strNewLine;
                SHUtils.For(0, pData.m_iMaxCol, (iCol) =>
                {
                    strBuff += string.Format("\t\t\t\"{0}\": {1},{2}",
                                             pData.m_ColumnNames[iCol],
                                             pData.m_pDatas[iCol],
                                             strNewLine);
                });
                strBuff  = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);
                strBuff += "\t\t}," + strNewLine;
            });
            strBuff  = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);
            strBuff += string.Format("\t],{0}", strNewLine);
        });
        strBuff  = string.Format("{0}{1}", strBuff.Substring(0, strBuff.Length - (strNewLine.Length + 1)), strNewLine);
        strBuff += "}";

        SHUtils.SaveFile(strBuff, string.Format("{0}/{1}.json", SHPath.GetPathToJson(), Path.GetFileNameWithoutExtension(strFileName)));
        #endif
    }