Пример #1
0
        private void errorHandler(SAFactoryEvent e)
        {
            SASocketDataDAO sdd = (SASocketDataDAO)e.Body;

            SError.Builder error = (SError.Builder)CommandCollection.getDataModel(ProtoTypeEnum.SError, sdd.bytes);
            SAUtils.LogError("错误码 : " + error.Code);
        }
Пример #2
0
 void LateUpdate()
 {
     if (suspendeds != null && suspendeds.Count > 0)
     {
         while (suspendeds.Count > 0)
         {
             lateUpdateAction = suspendeds[0];
             suspendeds.RemoveAt(0);
             LateEvent();
         }
     }
 }
Пример #3
0
        private void fishDieHandler(SAFactoryEvent action)
        {
            FishData fs = (FishData)action.Body;

            if (sofVO.ContainsKey(fs.id))
            {
                sofVO.Remove(fs.id);
            }

            if (sofVO.Count == 0)//发送挂起
            {
                CHangUpRoom.Builder hangUpRoom = CHangUpRoom.CreateBuilder();
                sock.sendMessage(ProtoTypeEnum.CHangUpRoom, hangUpRoom.Build().ToByteArray());
            }
        }
Пример #4
0
 protected override void init()
 {
     //这里初始化Lua
     originName = patchName.Replace(SAAppConfig.PrefabUIDir, "");
     luaName    = displayName.Substring(displayName.LastIndexOf(".") + 1);
     setActive(false);//初始化之后
     HideVec3 = SAManager.Instance.HideVec3;
     IsNew    = false;
     if (_start)
     {
         IsMainStart = true;
     }
     //ui对象引用
     slider       = getComponentForGameObjectName <UISlider>("Slider");
     stopWatch    = new Stopwatch();
     progressData = new ProgressData();
     factoryEvent = new SAFactoryEvent(SAACollection.PROGRESS, progressData);
 }
Пример #5
0
 void LateUpdate()
 {
     if (suspendeds != null && suspendeds.Count > 0)
     {
         while (suspendeds.Count > 0)
         {
             lateUpdateAction = suspendeds[0];
             suspendeds.RemoveAt(0);
             LateEvent();
         }
     }
     //生命周期线程合并
     if (IsNew)
     {
         init();
     }
     if (IsMainStart)
     {
         mainStart();
     }
     if (IsStart)
     {
         onSrart(args);
     }
     if (IsRegister)
     {
         onRegister();
     }
     if (IsRegisterComplete)
     {
         onRegisterComplete();
     }
     if (IsRemove)
     {
         onRemove();
     }
     if (IsDispose)
     {
         onDispose();
     }
 }
Пример #6
0
        private void fishChapterHandler(SAFactoryEvent action)
        {
            SASocketDataDAO sdd = (SASocketDataDAO)action.Body;

            fishChapter = (SFishChapter.Builder)CommandCollection.getDataModel(ProtoTypeEnum.SFishChapter, sdd.bytes);
            //关卡信息
            Dictionary <int, STChapter> chapterMap = STChapter.getMap();
            STChapter chapterData = chapterMap[fishChapter.ChapterID]; //关卡信息

            string[]        fishData = chapterData.SOF;                //关卡鱼群
            List <FishData> sof      = new List <FishData>();          //关卡鱼群数据整理

            sofVO = new Dictionary <int, FishData>();
            FishData fd;
            int      len = fishChapter.FishListCount; //只遍历存活的鱼群下标
            int      exist;                           //存活鱼的序号

            for (int i = 0; i < len; ++i)             //排列大小
            {
                exist = fishChapter.GetFishList(i);
                fd    = new FishData(exist, fishData[exist]);//找到存活的鱼数据
                sof.Add(fd);
                sofVO.Add(exist, fd);
            }
            sof.Sort((FishData f1, FishData f2) => //从小到大
            {
                return(f1.delay - f2.delay);
            });
            ft = gameObject.GetComponent <FishTarget>();
            if (null != ft)
            {
                ft.close();
                Destroy(ft);
            }

            ft = gameObject.AddComponent <FishTarget>();
            ft.init(this, fishChapter.StartTime, fishChapter.CurrentTime, sof);
        }
Пример #7
0
        /// <summary>
        /// 资源加载完成
        /// </summary>
        /// <param name="e"></param>
        private void updateLocalFileComplete(SAFactoryEvent e)
        {
            removeEventDispatcher(SAACollection.REFRESH + ActionCollection.LocalFile + SAACollection.COMPLETE);//资源加载完成

            //初始化 AssetBundleRemoteLua
            string localFilePath = Path.Combine(SAAppConfig.LuaRelease?SAAppConfig.RemoteLuaDir : SAAppConfig.DevLuaDir, originName + ".lua");
            bool   isExist       = File.Exists(localFilePath);//判断本地文件

            if (isExist)
            {
                luaEnv = new LuaEnv();
                luaEnv.AddLoader(LuaFile);
                luaEnv.DoString("require '" + localFilePath + "'");
                //################以下按照流程顺序补齐lua操作
                base.callLuaFun(SAACollection.luaNew, this);        //初始化
                base.callLuaFun(SAACollection.luaRegister);         //注册
                base.callLuaFun(SAACollection.luaStart);            //启动
                                                                    //内部自动处理加载关闭以及接下来的执行任务
                base.callLuaFun(SAACollection.luaRegisterComplete); //启动完毕
            }
            SAUtils.Log("AssetBundleFactory complete");

            int w = Screen.width;
            int h = Screen.height;


            //test = Instantiate((GameObject)SACache.getObjectWithName("model/cheqiyu/cheqiyu"));
            //test.GetComponent<Animator>().Play("swim");

            //ProtoTypeEnum.CLogin.ToString()
            //GameObject test = Instantiate(SACache.getResWithName<GameObject>("Model.FightPanelUI.FightPanelMap"));
            //GameObject test = Instantiate(UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>("Assets/_Resources/Model/FightPanelUI/FightPanelMap.prefab"));
            //test.transform.FindChild("Ground").transform.localPosition = new Vector3(0, 0.7f, 0);
            //test.transform.FindChild("FourDimensional").transform.localPosition = new Vector3(0, 0.7f, 0);
            //SALaunch.UIRootCamera.gameObject.SetActive(false);
        }
Пример #8
0
 /**
  * 通过工厂派发消息后从这里得到派发数据。
  * @param action 消息内容,常用属于性有type(消息类型)、body(消息携带的数据)。
  * @see FactoryEvent
  *
  * 线程锁在这里处理
  */
 public void handleAction(SAFactoryEvent action)
 {
     suspendeds.Add(action);
     //		    trace("MVC : "+this+" < "+action.type);
 }
Пример #9
0
        private void addScoreHandler(SAFactoryEvent action)
        {
            FishData fd = (FishData)action.Body;

            lblScore.text = "分数 : " + STFish.getMap()[fd.fishID].Coin;
        }
Пример #10
0
 private void updateLocalFile(SAFactoryEvent e)
 {
     //有UI后在这里控制显示进度、内容等
     progressData.info = string.Format("{0} kb/s", (progressData.current / 1024d / stopWatch.Elapsed.TotalSeconds).ToString("0.00"));
     slider.value      = Convert.ToSingle(currentNum) / Convert.ToSingle(totalNum);
 }