コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        mSceneModule = NFRoot.Instance().GetPluginManager().FindModule <NFSceneModule>();
        GameObject xModelObject = mSceneModule.GetModelObject();

        ModelInput = xModelObject.GetComponent <NFModelInput>();
    }
コード例 #2
0
ファイル: NFRoot.cs プロジェクト: yanmf/NFClient
    void Start()
    {
        _instance = this;

        Debug.Log("Root Start");
        mPluginManager = new NFPluginManager();
        mPluginManager.Registered(new NFSDKPlugin(mPluginManager));
        mPluginManager.Registered(new NFLogicPlugin(mPluginManager));
        mPluginManager.Registered(new NFUIPlugin(mPluginManager));
        mPluginManager.Registered(new NFScenePlugin(mPluginManager));


        mClassModule = mPluginManager.FindModule <NFIClassModule>();
        mNetModule   = mPluginManager.FindModule <NFNetModule>();
        mUIModule    = mPluginManager.FindModule <NFUIModule>();

        //mClassModule.SetDataPath("../../_Out/");

        if (RuntimePlatform.Android == Application.platform ||
            RuntimePlatform.IPhonePlayer == Application.platform)
        {
            //mPluginManager.FindModule<NFIClassModule>().SetDataPath("./");
        }

        mPluginManager.Awake();
        mPluginManager.Init();
        mPluginManager.AfterInit();

        mUIModule.ShowUI <NFUILogin>();
        mTool.Init();

        mNetModule.StartConnect("192.168.13.133", 14001);

        DontDestroyOnLoad(gameObject);
    }
コード例 #3
0
ファイル: NFFallState.cs プロジェクト: zli1989/NFUnitySDK
 public NFFallState(GameObject gameObject, NFAnimaStateType eState, NFAnimaStateMachine xStateMachine, float fHeartBeatTime, float fExitTime, bool input = false)
     : base(gameObject, eState, xStateMachine, fHeartBeatTime, fExitTime, input)
 {
     xHeroMotor   = gameObject.GetComponent <NFHeroMotor>();
     mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
     mSceneModule = NFRoot.Instance().GetPluginManager().FindModule <NFSceneModule>();
 }
コード例 #4
0
ファイル: NFUISetting.cs プロジェクト: sl-sandy/NFUnitySDK
    public override void Init()
    {
        NFRoot.Instance().mbShowCMDGUI = true;

        toggleLowQuanlity.onValueChanged.AddListener(delegate(bool isOn) {
            this.OnQuanlityValueChanged(isOn, toggleLowQuanlity);
        });

        toggleMidQuanlity.onValueChanged.AddListener(delegate(bool isOn) {
            this.OnQuanlityValueChanged(isOn, toggleMidQuanlity);
        });

        toggleHighQuanlity.onValueChanged.AddListener(delegate(bool isOn) {
            this.OnQuanlityValueChanged(isOn, toggleHighQuanlity);
        });

        toggleCHINEASE.onValueChanged.AddListener(delegate(bool isOn) {
            mLanguageModule.SetLocalLanguage(NFrame.Language.Chinese);
        });

        toggleENGLISH.onValueChanged.AddListener(delegate(bool isOn) {
            mLanguageModule.SetLocalLanguage(NFrame.Language.English);
        });

        toggleFRENCH.onValueChanged.AddListener(delegate(bool isOn) {
            mLanguageModule.SetLocalLanguage(NFrame.Language.French);
        });

        toggleSPANISH.onValueChanged.AddListener(delegate(bool isOn) {
            mLanguageModule.SetLocalLanguage(NFrame.Language.Spanish);
        });

        exitButton.onClick.AddListener(OnExitBtnClick);
    }
コード例 #5
0
ファイル: NFRecordRowView.cs プロジェクト: zli1989/NFUnitySDK
 // Use this for initialization
 private void Awake()
 {
     mkernelModule  = NFRoot.Instance().GetPluginManager().FindModule <NFIKernelModule>();
     mClassModule   = NFRoot.Instance().GetPluginManager().FindModule <NFIClassModule>();
     mLoginModule   = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
     mElementModule = NFRoot.Instance().GetPluginManager().FindModule <NFIElementModule>();
 }
コード例 #6
0
ファイル: NFRecordColView.cs プロジェクト: zli1989/NFUnitySDK
    // Use this for initialization
    private void Awake()
    {
        mkernelModule  = NFRoot.Instance().GetPluginManager().FindModule <NFIKernelModule>();
        mClassModule   = NFRoot.Instance().GetPluginManager().FindModule <NFIClassModule>();
        mLoginModule   = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mElementModule = NFRoot.Instance().GetPluginManager().FindModule <NFIElementModule>();

        int       iNum    = 0;
        Transform tParent = this.transform.parent;

        while (tParent)
        {
            rowView = tParent.GetComponent <NFRecordRowView> ();
            if (rowView != null)
            {
                rowView.AddColView(col, this);
                break;
            }

            iNum++;
            if (iNum > 3)
            {
                break;
            }

            tParent = tParent.parent;
        }
    }
コード例 #7
0
    public NFIdleState(GameObject gameObject, NFAnimaStateType eState, NFAnimaStateMachine xStateMachine, float fHeartBeatTime, float fExitTime, bool input = false)
        : base(gameObject, eState, xStateMachine, fHeartBeatTime, fExitTime, input)
    {
        NFIPluginManager pluginManager = NFRoot.Instance().GetPluginManager();

        mKernelModule = pluginManager.FindModule <NFIKernelModule>();
        mLoginModule  = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mSceneModule  = NFRoot.Instance().GetPluginManager().FindModule <NFSceneModule>();
    }
コード例 #8
0
ファイル: NFUISetting.cs プロジェクト: zli1989/NFUnitySDK
    private void Awake()
    {
        NFIPluginManager xPluginManager = NFRoot.Instance().GetPluginManager();

        mLoginModule    = xPluginManager.FindModule <NFLoginModule>();
        mUIModule       = xPluginManager.FindModule <NFUIModule>();
        mEventModule    = xPluginManager.FindModule <NFIEventModule>();
        mLanguageModule = xPluginManager.FindModule <NFLanguageModule>();
    }
コード例 #9
0
ファイル: NFModelControl.cs プロジェクト: tzw28/NFUnitySDK
    // Start is called before the first frame update
    void Start()
    {
        mVertices  = new List <Vector3>();
        mUvs       = new List <Vector2>();
        mTriangles = new List <int>();

        mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mMainCamera  = GameObject.Find("Main Camera");
        mParts       = new List <GameObject>();
    }
コード例 #10
0
ファイル: NFModelSync.cs プロジェクト: tzw28/NFUnitySDK
    private void Start()
    {
        mxSyncBuffer = GetComponent <NFModelSyncBuffer>();

        mNetModule    = NFRoot.Instance().GetPluginManager().FindModule <NFNetModule>();
        mLoginModule  = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mHelpModule   = NFRoot.Instance().GetPluginManager().FindModule <NFHelpModule>();
        mKernelModule = NFRoot.Instance().GetPluginManager().FindModule <NFIKernelModule>();
        mMainCamera   = GameObject.Find("Main Camera");
    }
コード例 #11
0
ファイル: NFUIJoystick.cs プロジェクト: tzw28/NFUnitySDK
    private void Awake()
    {
        NFIPluginManager xPluginManager = NFRoot.Instance().GetPluginManager();

        mLoginModule = xPluginManager.FindModule <NFLoginModule>();
        mUIModule    = xPluginManager.FindModule <NFUIModule>();
        mNetModule   = xPluginManager.FindModule <NFNetModule>();
        mHelpModule  = xPluginManager.FindModule <NFHelpModule>();
        mSceneModule = xPluginManager.FindModule <NFSceneModule>();
    }
コード例 #12
0
    private void Start()
    {
        mxHeroMotor            = GetComponent <NFHeroMotor>();
        mxSyncBuffer           = GetComponent <NFHeroSyncBuffer>();
        mxBodyIdent            = GetComponent <NFBodyIdent>();
        mAnimaStateMachine     = GetComponent <NFAnimaStateMachine>();
        mAnimatStateController = GetComponent <NFAnimatStateController>();

        mxNetModule  = NFRoot.Instance().GetPluginManager().FindModule <NFNetModule>();
        mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mHelpModule  = NFRoot.Instance().GetPluginManager().FindModule <NFHelpModule>();
    }
コード例 #13
0
ファイル: NFUIMain.cs プロジェクト: zli1989/NFUnitySDK
    private void Awake()
    {
        NFIPluginManager xPluginManager = NFRoot.Instance().GetPluginManager();

        mNetModule   = xPluginManager.FindModule <NFNetModule>();
        mLoginModule = xPluginManager.FindModule <NFLoginModule>();
        mUIModule    = xPluginManager.FindModule <NFUIModule>();
        mEventModule = xPluginManager.FindModule <NFIEventModule>();

        mKernelModule  = NFRoot.Instance().GetPluginManager().FindModule <NFIKernelModule>();
        mElementModule = NFRoot.Instance().GetPluginManager().FindModule <NFIElementModule>();
    }
コード例 #14
0
ファイル: NFUIMsgBox.cs プロジェクト: zli1989/NFUnitySDK
    // Use this for initialization


    public override void Init()
    {
        mEventModule = NFRoot.Instance().GetPluginManager().FindModule <NFIEventModule>();

        mNetModule   = NFRoot.Instance().GetPluginManager().FindModule <NFNetModule>();
        mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mUIModule    = NFRoot.Instance().GetPluginManager().FindModule <NFUIModule>();
        mHelpModule  = NFRoot.Instance().GetPluginManager().FindModule <NFHelpModule>();

        mAcceptButton.onClick.AddListener(OnAcceptClick);
        mRejectButton.onClick.AddListener(OnRejectClick);
    }
コード例 #15
0
ファイル: NFUILogin.cs プロジェクト: zli1989/NFUnitySDK
    // Use this for initialization


    public override void Init()
    {
        mEventModule = NFRoot.Instance().GetPluginManager().FindModule <NFIEventModule>();

        mNetModule   = NFRoot.Instance().GetPluginManager().FindModule <NFNetModule>();
        mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mUIModule    = NFRoot.Instance().GetPluginManager().FindModule <NFUIModule>();
        mHelpModule  = NFRoot.Instance().GetPluginManager().FindModule <NFHelpModule>();

        mLogin.onClick.AddListener(OnLoginClick);

        mEventModule.RegisterCallback((int)NFLoginModule.Event.LoginSuccess, OnLoginSuccess);
    }
コード例 #16
0
ファイル: NFModelInput.cs プロジェクト: tzw28/NFUnitySDK
    void Start()
    {
        mUIModule    = NFRoot.Instance().GetPluginManager().FindModule <NFUIModule>();
        mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mNetModule   = NFRoot.Instance().GetPluginManager().FindModule <NFNetModule>();
        mSceneModule = NFRoot.Instance().GetPluginManager().FindModule <NFSceneModule>();

        mKernelModule = NFRoot.Instance().GetPluginManager().FindModule <NFIKernelModule>();

        mMainCamera = GameObject.Find("Main Camera");
        GetModelInfoList();
        // mSceneModule.SetCurrentModel(-1);
    }
コード例 #17
0
ファイル: NFUIProfile.cs プロジェクト: zli1989/NFUnitySDK
    private void Awake()
    {
        mEventModule   = NFRoot.Instance().GetPluginManager().FindModule <NFIEventModule>();
        mKernelModule  = NFRoot.Instance().GetPluginManager().FindModule <NFIKernelModule>();
        mElementModule = NFRoot.Instance().GetPluginManager().FindModule <NFIElementModule>();
        mClassModule   = NFRoot.Instance().GetPluginManager().FindModule <NFIClassModule>();

        mSceneModule    = NFRoot.Instance().GetPluginManager().FindModule <NFSceneModule>();
        mLanguageModule = NFRoot.Instance().GetPluginManager().FindModule <NFLanguageModule>();
        mNetModule      = NFRoot.Instance().GetPluginManager().FindModule <NFNetModule>();
        mLoginModule    = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mUIModule       = NFRoot.Instance().GetPluginManager().FindModule <NFUIModule>();
        mHelpModule     = NFRoot.Instance().GetPluginManager().FindModule <NFHelpModule>();
    }
コード例 #18
0
ファイル: NFHeroInput.cs プロジェクト: zli1989/NFUnitySDK
    void Start()
    {
        mStateMachineMng = GetComponent <NFAnimaStateMachine>();
        mBodyIdent       = GetComponent <NFBodyIdent>();
        mHeroMotor       = GetComponent <NFHeroMotor>();

        mUIModule    = NFRoot.Instance().GetPluginManager().FindModule <NFUIModule>();
        mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();

        mKernelModule = NFRoot.Instance().GetPluginManager().FindModule <NFIKernelModule>();

        mKernelModule.RegisterPropertyCallback(mBodyIdent.GetObjectID(), NFrame.Player.MOVE_SPEED, PropertyMoveSpeedHandler);
        mKernelModule.RegisterPropertyCallback(mBodyIdent.GetObjectID(), NFrame.Player.ATK_SPEED, PropertyAttackSpeedHandler);

        mHeroMotor.angularSpeed = 0f;
    }
コード例 #19
0
    //=================================================================================================================o
    public override void Awake()
    {
        base.Awake();
        _walkSpeed   = 1.5f;
        angularSpeed = 0f;

        mKernelModule = NFRoot.Instance().GetPluginManager().FindModule <NFIKernelModule>();

        mSceneModule = NFRoot.Instance().GetPluginManager().FindModule <NFSceneModule>();
        mLoginModule = NFRoot.Instance().GetPluginManager().FindModule <NFLoginModule>();
        mNetModule   = NFRoot.Instance().GetPluginManager().FindModule <NFNetModule>();

        mUIModule = NFRoot.Instance().GetPluginManager().FindModule <NFUIModule>();

        mAnima = GetComponent <NFAnimatStateController>();
    }
コード例 #20
0
    void Start()
    {
        _instance = this;

        Debug.Log("Root Start " + Application.platform);
        RenderSettings.fog = false;

        mConfig.Load();


        mPluginManager.Registered(new NFSDKPlugin(mPluginManager));
        mPluginManager.Registered(new NFUIPlugin(mPluginManager));
        mPluginManager.Registered(new NFScenePlugin(mPluginManager));

        mKernelModule = mPluginManager.FindModule <NFIKernelModule>();
        mClassModule  = mPluginManager.FindModule <NFIClassModule>();
        mNetModule    = mPluginManager.FindModule <NFNetModule>();
        mUIModule     = mPluginManager.FindModule <NFUIModule>();
        mLogModule    = mPluginManager.FindModule <NFLogModule>();


        mClassModule.SetDataPath(mConfig.GetDataPath());

        mPluginManager.Awake();
        mPluginManager.Init();
        mPluginManager.AfterInit();

        mUIModule.ShowUI <NFUILogin>();

        if (mConfig.GetServerList().Count > 1)
        {
            mbShowServer = true;
        }
        else
        {
            string strTargetIP = "127.0.0.1";
            if (mConfig.GetSelectServer(ref strTargetIP))
            {
                mNetModule.StartConnect(strTargetIP, port);
            }
        }



        DontDestroyOnLoad(gameObject);
    }
コード例 #21
0
    public void Awake()
    {
        NFIPluginManager pluginManager = NFRoot.Instance().GetPluginManager();

        xBodyIdent = GetComponent <NFBodyIdent>();

        mKernelModule  = pluginManager.FindModule <NFIKernelModule>();
        mElementModule = pluginManager.FindModule <NFIElementModule>();
        mLoginModule   = pluginManager.FindModule <NFLoginModule>();

        AddState(NFAnimaStateType.Idle, new NFIdleState(this.gameObject, NFAnimaStateType.Idle, this, 1f, 0f, true));
        AddState(NFAnimaStateType.Idle1, new NFIdleState(this.gameObject, NFAnimaStateType.Idle, this, 1f, 0f, true));
        AddState(NFAnimaStateType.Idle2, new NFIdleState(this.gameObject, NFAnimaStateType.Idle, this, 1f, 0f, true));

        AddState(NFAnimaStateType.Run, new NFRunState(this.gameObject, NFAnimaStateType.Run, this, 1f, 0f, true));
        AddState(NFAnimaStateType.Walk, new NFWalkState(this.gameObject, NFAnimaStateType.Walk, this, 1f, 0f, true));
        AddState(NFAnimaStateType.Dizzy, new NFDizzyState(this.gameObject, NFAnimaStateType.Dizzy, this, 1f, 0f));
        AddState(NFAnimaStateType.Freeze, new NFFreezeState(this.gameObject, NFAnimaStateType.Freeze, this, 1f, 0f));
        AddState(NFAnimaStateType.Block, new NFBlockState(this.gameObject, NFAnimaStateType.Block, this, 1f, 0f));
        AddState(NFAnimaStateType.Fall, new NFFallState(this.gameObject, NFAnimaStateType.Fall, this, 1f, 0f));
        AddState(NFAnimaStateType.Dead, new NFDeadState(this.gameObject, NFAnimaStateType.Dead, this, 1f, 0f));
        AddState(NFAnimaStateType.JumpStart, new NFJumpStartState(this.gameObject, NFAnimaStateType.JumpStart, this, 1f, 0f));
        AddState(NFAnimaStateType.Jumping, new NFJumpingState(this.gameObject, NFAnimaStateType.Jumping, this, 1f, 0f));
        AddState(NFAnimaStateType.JumpLand, new NFJumpLandState(this.gameObject, NFAnimaStateType.JumpLand, this, 0.1f, 0.4f));
        AddState(NFAnimaStateType.BeHit1, new NFBeHitState(this.gameObject, NFAnimaStateType.BeHit1, this, 1f, 0f));
        AddState(NFAnimaStateType.BeHit2, new NFBeHitState(this.gameObject, NFAnimaStateType.BeHit2, this, 1f, 0f));
        AddState(NFAnimaStateType.HitFly, new NFHitFlyState(this.gameObject, NFAnimaStateType.HitFly, this, 1f, 0f));
        AddState(NFAnimaStateType.Stun, new NFHitFlyState(this.gameObject, NFAnimaStateType.Stun, this, 1f, 0f));

        AddState(NFAnimaStateType.DashForward, new NFDashForwardState(this.gameObject, NFAnimaStateType.DashForward, this, 1f, 0f));
        AddState(NFAnimaStateType.DashJump, new NFDashForwardState(this.gameObject, NFAnimaStateType.DashJump, this, 1f, 0f));

        AddState(NFAnimaStateType.Buff1, new NFBuff1(this.gameObject, NFAnimaStateType.Buff1, this, 1f, 0f));

        AddState(NFAnimaStateType.NormalSkill1, new NFNormalSkill1(this.gameObject, NFAnimaStateType.NormalSkill1, this, 1f, 0f));
        AddState(NFAnimaStateType.NormalSkill2, new NFNormalSkill2(this.gameObject, NFAnimaStateType.NormalSkill2, this, 1f, 0f));
        AddState(NFAnimaStateType.NormalSkill3, new NFNormalSkill3(this.gameObject, NFAnimaStateType.NormalSkill3, this, 1f, 0f));
        AddState(NFAnimaStateType.NormalSkill4, new NFNormalSkill4(this.gameObject, NFAnimaStateType.NormalSkill4, this, 1f, 0f));
        AddState(NFAnimaStateType.NormalSkill5, new NFNormalSkill5(this.gameObject, NFAnimaStateType.NormalSkill5, this, 1f, 0f));

        AddState(NFAnimaStateType.SpecialSkill1, new NFSpecialSkill1(this.gameObject, NFAnimaStateType.SpecialSkill1, this, 1f, 0f));
        AddState(NFAnimaStateType.SpecialSkill2, new NFSpecialSkill2(this.gameObject, NFAnimaStateType.SpecialSkill2, this, 1f, 0f));
        AddState(NFAnimaStateType.SkillThump, new NFSkillThump(this.gameObject, NFAnimaStateType.SkillThump, this, 1f, 0f));
    }
コード例 #22
0
    public override void OnCheckInput(GameObject gameObject)
    {
        if (mStateMachine.IsMainRole())
        {
            //hp
            if (mKernelModule.QueryPropertyInt(xBodyIdent.GetObjectID(), NFrame.NPC.HP) <= 0)
            {
                return;
            }

            if (NFRoot.Instance().GetGameMode() == GAME_MODE.GAME_MODE_2D)
            {
                bool left  = false;
                bool right = false;
                bool top   = false;

                if (xHeroMotor.GetMoveDrictor().z > 0)
                {
                    top = true;
                }

                if (xHeroMotor.GetMoveDrictor().x < 0)
                {
                    left = true;
                    xHeroMotor.ProcessInput(left, right, top);
                    if (top)
                    {
                        mAnimatStateController.PlayAnimaState(NFAnimaStateType.JumpStart, -1);
                    }
                    else
                    {
                        mAnimatStateController.PlayAnimaState(NFAnimaStateType.Run, -1);
                    }
                }
                else if (xHeroMotor.GetMoveDrictor().x > 0)
                {
                    right = true;
                    xHeroMotor.ProcessInput(left, right, top);
                    if (top)
                    {
                        mAnimatStateController.PlayAnimaState(NFAnimaStateType.JumpStart, -1);
                    }
                    else
                    {
                        mAnimatStateController.PlayAnimaState(NFAnimaStateType.Run, -1);
                    }
                }
                else
                {
                    if (top)
                    {
                        xHeroMotor.ProcessInput(left, right, top);
                        mAnimatStateController.PlayAnimaState(NFAnimaStateType.JumpStart, -1);
                    }
                }
            }
            else
            {
                if (xHeroMotor.GetMoveDrictor() != Vector3.zero)
                {
                }
            }
        }
    }
コード例 #23
0
ファイル: NFUISetting.cs プロジェクト: sl-sandy/NFUnitySDK
 public void OnCMDChanged(bool ison, Toggle sender)
 {
     NFRoot.Instance().mbShowCMDGUI = ison;
 }
コード例 #24
0
    public override void Init()
    {
        NFIPluginManager xPluginManager = NFRoot.Instance().GetPluginManager();

        mKernelModule = xPluginManager.FindModule <NFIKernelModule>();
    }
コード例 #25
0
ファイル: NFDeadState.cs プロジェクト: zli1989/NFUnitySDK
 public NFDeadState(GameObject gameObject, NFAnimaStateType eState, NFAnimaStateMachine xStateMachine, float fHeartBeatTime, float fExitTime, bool input = false)
     : base(gameObject, eState, xStateMachine, fHeartBeatTime, fExitTime, input)
 {
     mUIModule = NFRoot.Instance().GetPluginManager().FindModule <NFUIModule>();
 }
コード例 #26
0
    void RecordEventHandler(NFGUID self, string strRecordName, NFIRecord.ERecordOptype eType, int nRow, int nCol, NFDataList.TData oldVar, NFDataList.TData newVar)
    {
        if (ColValueCondition)
        {
            if (eType == NFIRecord.ERecordOptype.Add)
            {
                if (ColConditionNum >= 0 && ColConditionContent.Length > 0)
                {
                    NFIRecord xRecord = mkernelModule.FindRecord(self, recordName);
                    if (xRecord != null)
                    {
                        if (xRecord.GetCols() > ColConditionNum)
                        {
                            switch (xRecord.GetColType(ColConditionNum))
                            {
                            case NFDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                long value = xRecord.QueryInt(nRow, ColConditionNum);
                                if (value.ToString() != ColConditionContent)
                                {
                                    //remove
                                    return;
                                }
                            }
                            break;

                            case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                string value = xRecord.QueryString(nRow, ColConditionNum);
                                if (value != ColConditionContent)
                                {
                                    //remove
                                    return;
                                }
                            }
                            break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
            else if (eType == NFIRecord.ERecordOptype.Update)
            {
                if (nCol == ColConditionNum)
                {
                    if (ColConditionNum >= 0 && ColConditionContent.Length > 0)
                    {
                        NFIRecord xRecord = mkernelModule.FindRecord(self, recordName);
                        if (xRecord != null)
                        {
                            if (xRecord.GetCols() > ColConditionNum)
                            {
                                switch (xRecord.GetColType(ColConditionNum))
                                {
                                case NFDataList.VARIANT_TYPE.VTYPE_INT:
                                {
                                    long value = newVar.IntVal();
                                    if (value.ToString() != ColConditionContent)
                                    {
                                        //remove
                                        DestroyObject(nRow);
                                        return;
                                    }
                                }
                                break;

                                case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                                {
                                    string value = newVar.StringVal();
                                    if (value != ColConditionContent)
                                    {
                                        //remove
                                        DestroyObject(nRow);
                                        return;
                                    }
                                }
                                break;

                                default:
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }

        if (ColPropertyCondition)
        {
            if (ColConditionNum >= 0 && ColConditionPropertyName.Length > 0 && ColConditionPropertyValue.Length > 0)
            {
                NFIRecord xRecord = mkernelModule.FindRecord(self, recordName);
                if (xRecord != null)
                {
                    if (xRecord.GetCols() > ColConditionNum)
                    {
                        switch (xRecord.GetColType(ColConditionNum))
                        {
                        case NFDataList.VARIANT_TYPE.VTYPE_INT:
                        {
                            long       value    = xRecord.QueryInt(nRow, ColConditionNum);
                            NFIElement xElement = mElementModule.GetElement(value.ToString());
                            if (xElement == null)
                            {
                                Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value.ToString());
                                return;
                            }

                            NFIProperty xProperty = xElement.GetPropertyManager().GetProperty(ColConditionPropertyName);
                            if (xProperty == null)
                            {
                                Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value.ToString() + " Property:" + ColConditionPropertyName);
                                return;
                            }

                            if (xProperty.GetData() != null)
                            {
                                switch (xProperty.GetData().GetType())
                                {
                                case NFDataList.VARIANT_TYPE.VTYPE_INT:
                                {
                                    if (xProperty.QueryInt().ToString() != ColConditionPropertyValue)
                                    {
                                        return;
                                    }
                                }
                                break;

                                case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                                {
                                    if (xProperty.QueryString() != ColConditionPropertyValue)
                                    {
                                        return;
                                    }
                                }
                                break;
                                }
                            }
                        }
                        break;

                        case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                        {
                            string     value    = xRecord.QueryString(nRow, ColConditionNum);
                            NFIElement xElement = mElementModule.GetElement(value);
                            if (xElement == null)
                            {
                                Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value);
                                return;
                            }

                            NFIProperty xProperty = xElement.GetPropertyManager().GetProperty(ColConditionPropertyName);
                            if (xProperty == null)
                            {
                                Debug.LogError("Col:" + ColConditionNum.ToString() + " Value:" + value + " Property:" + ColConditionPropertyName);
                                return;
                            }

                            if (xProperty.GetData() != null)
                            {
                                switch (xProperty.GetData().GetType())
                                {
                                case NFDataList.VARIANT_TYPE.VTYPE_INT:
                                {
                                    if (xProperty.QueryInt().ToString() != ColConditionPropertyValue)
                                    {
                                        return;
                                    }
                                }
                                break;

                                case NFDataList.VARIANT_TYPE.VTYPE_STRING:
                                {
                                    if (xProperty.QueryString() != ColConditionPropertyValue)
                                    {
                                        return;
                                    }
                                }
                                break;
                                }
                            }
                        }
                        break;

                        default:
                            break;
                        }
                    }
                }
            }
        }

        switch (eType)
        {
        case NFIRecord.ERecordOptype.Add:
        {
            NFRecordRowData rowData = new NFRecordRowData();
            rowData.row        = nRow;
            rowData.recordName = strRecordName;
            rowData.id         = self;

            _data.Add(rowData);


            NFRoot.Instance().StartCoroutine(CreateObject(self, rowViewItem, rowData));
        }
        break;

        case NFIRecord.ERecordOptype.Del:
        {
            int nIndex = -1;
            for (int i = 0; i < _data.Count; ++i)
            {
                NFRecordRowData rowData = _data[i];
                if (rowData.row == nRow)
                {
                    nIndex = i;
                    break;
                }
            }

            if (nIndex >= 0)
            {
                _data.RemoveAt(nIndex);
            }

            NFRecordRowView[] rowViews = this.GetComponentsInChildren <NFRecordRowView>();
            for (int i = 0; i < rowViews.Length; ++i)
            {
                NFRecordRowData rowData = rowViews[i].GetData();
                if (rowData != null &&
                    rowData.row == nRow)
                {
                    GameObject.Destroy(rowViews[i].gameObject);
                    break;
                }
            }
        }
        break;

        case NFIRecord.ERecordOptype.Update:
        {
            if (ColValueCondition)
            {
                if (nCol == ColConditionNum)
                {
                    int nIndex = -1;
                    for (int i = 0; i < _data.Count; ++i)
                    {
                        NFRecordRowData rowData = _data[i];
                        if (rowData.row == nRow)
                        {
                            nIndex = i;
                            break;
                        }
                    }

                    if (nIndex < 0)
                    {
                        //add a new one
                        NFRecordRowData rowData = new NFRecordRowData();
                        rowData.row        = nRow;
                        rowData.recordName = strRecordName;
                        rowData.id         = self;

                        _data.Add(rowData);


                        NFRoot.Instance().StartCoroutine(CreateObject(self, rowViewItem, rowData));
                    }
                }
            }


            {
                NFRecordRowView[] rowViews = this.GetComponentsInChildren <NFRecordRowView>();
                for (int i = 0; i < rowViews.Length; ++i)
                {
                    NFRecordRowData rowData = rowViews[i].GetData();
                    if (rowData != null &&
                        rowData.row == nRow)
                    {
                        rowViews[i].SetData(self, recordName, this, rowData);
                        break;
                    }
                }
            }
        }
        break;

        case NFIRecord.ERecordOptype.Create:
            break;

        case NFIRecord.ERecordOptype.Cleared:
            _data.Clear();
            break;

        default:
            break;
        }
    }
コード例 #27
0
ファイル: NFLanguage.cs プロジェクト: zli1989/NFUnitySDK
 void Awake()
 {
     mLanguageModule = NFRoot.Instance().GetPluginManager().FindModule <NFLanguageModule>();
     mLanguageModule.AddLanguageUI(this.gameObject);
 }
コード例 #28
0
ファイル: NFUIModule.cs プロジェクト: zli1989/NFUnitySDK
        public T ShowUI <T>(bool bCloseLastOne = true, bool bPushHistory = true, NFDataList varList = null) where T : NFUIDialog
        {
            /*
             * if (mCurrentDialog != null && bCloseLastOne)
             * {
             *  Debug.Log("close ui " + mCurrentDialog.gameObject.name);
             *
             *  mCurrentDialog.gameObject.SetActive(false);
             *  mCurrentDialog = null;
             * }
             */

            string     name = typeof(T).ToString();
            GameObject uiObject;

            if (!mAllUIs.TryGetValue(name, out uiObject))
            {
                GameObject perfb = Resources.Load <GameObject>("UI/" + name);
                if (Application.platform == RuntimePlatform.Android ||
                    Application.platform == RuntimePlatform.IPhonePlayer ||
                    Application.platform == RuntimePlatform.OSXEditor ||
                    Application.platform == RuntimePlatform.WindowsEditor ||
                    Application.platform == RuntimePlatform.LinuxEditor)
                {
                    //perfb = Resources.Load<GameObject>("UI/" + name);
                }
                else
                {
                    //perfb = Resources.Load<GameObject>("UI/PC/" + name);
                }

                Debug.Log(name);

                uiObject      = GameObject.Instantiate(perfb);
                uiObject.name = name;

                uiObject.transform.SetParent(NFRoot.Instance().transform);

                mAllUIs.Add(name, uiObject);

                T panel = uiObject.GetComponent <T>();
                panel.Init();
            }
            else
            {
                uiObject.SetActive(true);

                //Debug.Log("open ui " + uiObject.gameObject.name);
            }

            if (uiObject)
            {
                T panel = uiObject.GetComponent <T>();
                if (varList != null)
                {
                    panel.mUserData = varList;
                }

                mCurrentDialog = panel;

                uiObject.SetActive(true);

                //Debug.Log("open ui " + uiObject.gameObject.name);

                if (bPushHistory)
                {
                    mDialogs.Enqueue(panel);
                }

                return(panel);
            }

            return(null);
        }