Exemple #1
0
    //private List<GameObject>[] mTmpFishGatheredView;//用于显示已收集的鱼
    void Awake()
    {
        //HitProcessor.FuncGetFishAddtiveForDieRatio += Func_GetFishOddAddtiveForDieRatio;
        HitProcessor.AddFunc_Odd(Func_GetFishOddAddtiveForDieRatio, null);
        GameMain.EvtFishKilled            += Evt_FishKilled;
        GameMain.EvtBGClearAllData_Before += Evt_BGClearAllData_Before;

        //mTmpFishGatheredView = new List<GameObject>[Defines.MaxNumPlayer];
        //for (int i = 0; i != mTmpFishGatheredView.Length; ++i)
        //    mTmpFishGatheredView[i] = new List<GameObject>();

        Players = GameMain.Singleton.Players;
        mPrefabNeedGatherFishCache = new Dictionary <int, int>();
        for (int i = 0; i != Prefab_GatherFishAry.Length; ++i)
        {
            mPrefabNeedGatherFishCache.Add(Prefab_GatherFishAry[i].TypeIndex, i);
        }

        //创建PersistentData
        if (PlayerGatheredFishRecs == null)
        {
            PlayerGatheredFishRecs = new PersistentData <uint, uint> [Defines.MaxNumPlayer];
            for (int i = 0; i != Defines.MaxNumPlayer; ++i)
            {
                PlayerGatheredFishRecs[i] = new PersistentData <uint, uint>("PlayerGatheredFishRecs" + i.ToString());
            }
        }
        if (PlayerGatheredScore == null)
        {
            PlayerGatheredScore = new PersistentData <int, int> [Defines.MaxNumPlayer];
            for (int i = 0; i != Defines.MaxNumPlayer; ++i)
            {
                PlayerGatheredScore[i] = new PersistentData <int, int>("PlayerGatheredScore" + i.ToString());
            }
        }
        //创建 PlayerGatheredFish
        PlayerGatheredFish = new Dictionary <int, object> [Defines.MaxNumPlayer];


        //由PlayerGatheredFishRec得出字典PlayerGatheredFish
        for (int playerIdx = 0; playerIdx != Defines.MaxNumPlayer; ++playerIdx)
        {
            PlayerGatheredFish[playerIdx] = new Dictionary <int, object>();

            for (int gIdx = 0; gIdx != Prefab_GatherFishAry.Length; ++gIdx)//收集索引
            {
                if (((PlayerGatheredFishRecs[playerIdx].Val >> gIdx) & 1) == 1)
                {
                    PlayerGatheredFish[playerIdx].Add(gIdx, null);
                    //_tmpAddViewAniFish(gIdx, Players[playerIdx];
                }
            }
        }
    }
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     if (nameSetAniBulletLizi == null || nameSetAniBulletNor == null || Prefab_AniBullet == null)
     {
         Debug.LogError("Module_BulletSplit有变量未赋值");
         return;
     }
     for (int i = 0; i != ModuleBullet.Fireable.Length; ++i)
     {
         ModuleBullet.Fireable[i] = false;
     }
     GameMain.EvtPlayerGunFired += Handle_GunFire;
     HitProcessor.AddFunc_Odd(Func_GetFishDieRatioAddtive, null);
 }
Exemple #3
0
        private Dictionary <int, Fish> mSlayFishCache;         //可被杀死鱼cache,与Prefab_SlayFish关联
        void Awake()
        {
            //HitProcessor.FuncGetFishAddtiveForDieRatio += Func_GetFishOddAddtiveForDieRatio;
            HitProcessor.AddFunc_Odd(Func_GetFishOddAddtiveForDieRatio, null);

            /*GameMain.EvtFishKilled += Event_FishKilled;
             * GameMain.EvtMainProcessFinishPrelude += Event_MainProcess_FinishPrelude;
             * GameMain.EvtMainProcessFirstEnterScene += Event_MainProcess_FirstEnterScene;
             * GameMain.EvtBgClearAllDataBefore += Event_BackGroundClearAllData_Before;*///adq

            DragonSlayerScores = new PersistentData <int, int> [Defines.MaxNumPlayer];
            for (int i = 0; i != Defines.MaxNumPlayer; ++i)
            {
                DragonSlayerScores[i] = new PersistentData <int, int>("DragonSlayerScores" + i.ToString());
            }

            foreach (Fish f in Prefab_SlayFish)
            {
                RandomOddsNum rndOdd = f.GetComponent <RandomOddsNum>();
                if (rndOdd != null)
                {
                    mSlayFishAveragyOdd += (rndOdd.MinOdds + rndOdd.MaxOdds) / 2;
                }
                else
                {
                    mSlayFishAveragyOdd += f.Odds;
                }
            }

            mSlayFishCache = new Dictionary <int, Fish>();
            foreach (Fish f in Prefab_SlayFish)
            {
                mSlayFishCache.Add(f.TypeIndex, f);
            }

            mSlayFishAveragyOdd /= Prefab_SlayFish.Length;
            //GenerateDragonSlayer(0);
        }
Exemple #4
0
 // Use this for initialization
 void Start()
 {
     HitProcessor.AddFunc_Odd(Func_GetFishOddAdditive, Func_GetFishOddAdditive);
 }