コード例 #1
0
ファイル: BehaviourTrigger.cs プロジェクト: tsinglee2009/Dczg
    // 触发事件(继承自BehaviourTrigger)aa
    public override void SyncUpdate(sdBehaviourStateBlock kBehaviourStateBlock)
    {
        if (kBehaviourStateBlock.BehaviourStateEventType != EBehaviourStateEventType.enBSET_Killed)
        {
            return;
        }

        if (mIsTriggered != true)
        {
            mIsTriggered = true;
            if (IsEnterTrigger && NotifyEnterTrigger != null)
            {
                if (!BundleGlobal.IsMobile())
                {
                    //Debug.Log("sdKilledBehaviourTrigger::NotifyEnterTrigger");
                }
                NotifyEnterTrigger(this);
            }
        }

        if (mIsTriggered != false)
        {
            mIsTriggered = false;
            if (IsLeaveTrigger && NotifyLeaveTrigger != null)
            {
                if (!BundleGlobal.IsMobile())
                {
                    //Debug.Log("sdKilledBehaviourTrigger::NotifyLeaveTrigger");
                }
                NotifyLeaveTrigger(this);
            }
        }
    }
コード例 #2
0
    void __PreLoadResource(string path, uint refCount, System.Type t)
    {
        if (!BundleGlobal.IsMobile())
        {
            return;
        }
        if (path.Length == 0)
        {
            return;
        }
        bool resourceExist = resourceDB.ContainsKey(path);

        if (resourceExist)
        {
            ResourceTask task = resourceDB[path] as ResourceTask;
            task.Ref = refCount;
        }
        else
        {
            ResourceTask task = new ResourceTask();
            task._name       = path;
            task._param      = null;
            task.Ref         = refCount;
            resourceDB[path] = task;

            AddTask(path, t, -1);
        }
    }
コード例 #3
0
    // 触发动作(触发条件调用,继承自sdBehaviourAction)aa
    public override void DoSyncAction()
    {
        if (!BundleGlobal.IsMobile())
        {
            //Debug.Log("sdSummonBehaviourAction::DoSyncAction");
        }

        if (mSummonLevelArea == null)
        {
            GameObject kSummonLevelAreaObject = GameObject.Find(mLevelAreaName);
            if (kSummonLevelAreaObject)
            {
                mSummonLevelArea = kSummonLevelAreaObject.GetComponent <sdLevelArea>();
            }

            if (mSummonLevelArea == null)
            {
                return;
            }
        }

        sdSummonBehaviourAction kDelaySummonBehaviourAction = this.Clone() as sdSummonBehaviourAction;

        kDelaySummonBehaviourAction.TimeStamp        = Time.time;
        kDelaySummonBehaviourAction.mSummonLevelArea = this.mSummonLevelArea;

        mBehaviourAdvancedState.AddBehaviourActionToDelayList(kDelaySummonBehaviourAction);
    }
コード例 #4
0
    public static void init()
    {
        CliProto.AddEncode_Decode();
        if (Application.platform != RuntimePlatform.WindowsEditor)
        {
            Login_IP = "127.0.0.1";
        }
        else
        {
            // 只有在内网172网段才使用内网服务器地址.. 并且不是移动平台..
            string ip  = Network.player.ipAddress;
            int    idx = ip.IndexOf('.');
            // !!!
            // 请在login场景的bt_startgame按钮的属性表里设置Serverip,不要直接修改这个脚本
            // !!!
            if (idx > 0 && ip.Substring(0, idx) == "172" && (!BundleGlobal.IsMobile() || BundleGlobal.InternalNetDebug))
            {
                Login_IP     = "172.30.10.124";
                bInternalNet = true;
            }
            else
            {
                Login_IP = "127.0.0.1";
            }
        }
        Login_Port = 8000;

        setCallBackFunc((ushort)CliProto.EN_CliProto_MessageID.GCID_ERROR, OnMessage_GCID_ERROR);

        SDGlobal.Log("before enterscene");
        sdEnterScene.init();
        SDGlobal.Log("before item Msg");
        sdItemMsg.init();
        SDGlobal.Log("itemMsg");
        sdSkillMsg.init();
        SDGlobal.Log("actorMsg");
        sdActorMsg.init();
        SDGlobal.Log("petMsg");
        sdPetMsg.init();
        SDGlobal.Log("chat");
        sdChatMsg.init();
        SDGlobal.Log("friend");
        sdFriendMsg.init();
        SDGlobal.Log("ActGameMsg");
        sdActGameMsg.init();
        sdMallMsg.init();
        SDGlobal.Log("MailMsg");
        sdMailMsg.init();
        SDGlobal.Log("pvpMsg");
        sdPVPMsg.init();
        SDGlobal.Log("AwardCenterMsg");
        sdAwardCenterMsg.init();
        SDGlobal.Log("RoleCreateMsg");
        sdRoleCreateMsg.init();
        sdMysteryShopMsg.init();
        sdRankLisrMsg.init();
        sdBBSMsg.init();
        sdLevelMsg.init();
    }
コード例 #5
0
    // 触发动作(触发条件调用,继承自sdBehaviourAction)aa
    public override void DoSyncAction()
    {
        if (!BundleGlobal.IsMobile())
        {
            //Debug.Log("sdSkillBehaviourAction::DoSyncAction");
        }

        sdDelaySkillBehaviourAction kDelaySkillBehaviourAction = new sdDelaySkillBehaviourAction();

        kDelaySkillBehaviourAction.Count                  = this.Count;
        kDelaySkillBehaviourAction.DelayTime              = this.mDelayTime;
        kDelaySkillBehaviourAction.IntervalTime           = this.mIntervalTime;
        kDelaySkillBehaviourAction.TimeStamp              = this.mTimeStamp;
        kDelaySkillBehaviourAction.BehaviourAdvancedState = this.mBehaviourAdvancedState;

        kDelaySkillBehaviourAction.SkillBehavuourAction = this;

        mBehaviourAdvancedState.AddBehaviourActionToDelayList(kDelaySkillBehaviourAction);
    }
コード例 #6
0
ファイル: BehaviourTrigger.cs プロジェクト: tsinglee2009/Dczg
    // 触发事件(继承自BehaviourTrigger)aa
    public override void SyncUpdate(sdBehaviourStateBlock kBehaviourStateBlock)
    {
        if (kBehaviourStateBlock.BehaviourStateEventType != EBehaviourStateEventType.enBSET_HP)
        {
            return;
        }

        int   iMaxHP               = kBehaviourStateBlock.MaxHP;
        int   iLastHP              = kBehaviourStateBlock.PreviousHP;
        int   iCurrentHP           = iLastHP + kBehaviourStateBlock.ChangeHP;
        float fLastHPPercentage    = (float)iLastHP / (float)iMaxHP;
        float fCurrentHPPercentage = (float)iCurrentHP / (float)iMaxHP;

        if (fCurrentHPPercentage < mConditionPercent)
        {
            if (fLastHPPercentage >= mConditionPercent)
            {
                if (mBHPBTCType == EHPBehaviourTriggerCompareType.enBHPBTCT_Less)
                {
                    if (mIsTriggered != true)
                    {
                        mIsTriggered = true;
                        if (IsEnterTrigger && NotifyEnterTrigger != null)
                        {
                            if (!BundleGlobal.IsMobile())
                            {
                                //Debug.Log("sdHPBehaviourTrigger::NotifyEnterTrigger");
                            }
                            NotifyEnterTrigger(this);
                        }
                    }

                    if (mIsTriggered != false)
                    {
                        mIsTriggered = false;
                        if (IsLeaveTrigger && NotifyLeaveTrigger != null)
                        {
                            if (!BundleGlobal.IsMobile())
                            {
                                //Debug.Log("sdHPBehaviourTrigger::NotifyLeaveTrigger");
                            }
                            NotifyLeaveTrigger(this);
                        }
                    }
                }
            }
        }
        else
        {
            if (fLastHPPercentage < mConditionPercent)
            {
                if (mBHPBTCType == EHPBehaviourTriggerCompareType.enBHPBTCT_EqualBigger)
                {
                    if (mIsTriggered != true)
                    {
                        mIsTriggered = true;
                        if (IsEnterTrigger && NotifyEnterTrigger != null)
                        {
                            if (!BundleGlobal.IsMobile())
                            {
                                //Debug.Log("sdHPBehaviourTrigger::NotifyEnterTrigger");
                            }
                            NotifyEnterTrigger(this);
                        }
                    }

                    if (mIsTriggered != false)
                    {
                        mIsTriggered = false;
                        if (IsLeaveTrigger && NotifyLeaveTrigger != null)
                        {
                            if (!BundleGlobal.IsMobile())
                            {
                                //Debug.Log("sdHPBehaviourTrigger::NotifyLeaveTrigger");
                            }
                            NotifyLeaveTrigger(this);
                        }
                    }
                }
            }
        }
    }