public WCFService(Func<IServiceBus> serviceBus, IMessageTracker tracker, IMessageBucket messages, DelegateManager manager) { this.serviceBus = serviceBus; this.tracker = tracker; this.messages = messages; this.manager = manager; }
public RemotingManager(IContextLoader contextLoader) { ServiceManager = new ServiceManager(this); DelegateManager = new DelegateManager(this); ReferenceManager = new ReferenceManager(this); ContextManager = new ContextManager(this, contextLoader); }
public void OnDrop(PointerEventData eventData) { if (eventData.pointerDrag == null) { return; } eventData.pointerDrag.GetComponent <RectTransform>().anchoredPosition = rectTransform.anchoredPosition; myMat = eventData.pointerDrag; myMatRect = myMat.GetComponent <RectTransform>(); myMatDragDrop = myMat.GetComponent <DragDrop>(); if (DelegateManager.currentCraftingMaterials.Count < 3) { DelegateManager.currentCraftingMaterials.Add(myMat); DelegateManager.updateCurrentCraftingMaterials(); //Debug.Log(DelegateManager.currentCraftingMaterials.Count); } else { //Debug.Log(DelegateManager.currentCraftingMaterials.Count); Debug.Log("Crafting Materials at Max!"); } }
public void ResizeBeam(float size) { float halfheight = (int)(size / 2f); float halfwidth = beamThickness / 2f; float angle = VMath.VectorToAngle(stick); Polygon p = (Polygon)beamNode.body.shape; p.SetBox(halfwidth, halfheight, false); Vector2R endpos = parent.body.pos + (stick.NormalizeSafe() * halfheight); beamNode.body.pos = endpos; p.SetOrient(angle); Vector2R normal = new Vector2R(-stick.Y, stick.X).NormalizeSafe(); if (normal == Vector2R.Zero) { return; } Color c = Color.Blue; int r = Math.Sign(128 - c.R) * 10; int g = Math.Sign(128 - c.G) * 10; int b = Math.Sign(128 - c.B) * 10; for (int i = 0; i < beamThickness; i++) { Vector2R offset = normal * (i - beamThickness / 2); Vector2R start = parent.body.pos + offset; Vector2R end = start + (stick.NormalizeSafe() * size); int seed = (int)DelegateManager.Triangle((i + tempColorVal), maxColorVal); Color newcol = new Color(c.R + r * seed, c.G + g * seed, c.B + g * seed); // *0.5f; room.Camera.DrawLine(start, end, 1f, newcol, (int)Layers.Under2); } tempColorVal += colorValSpeed; }
// Update is called once per frame void Update() { if (ReceiveMsgList.Count > 0) { MsgPack msg = ReceiveMsgList.Dequeue(); switch (msg.MsgType) { case MsgType.CsFirstHandMsg: playerID = msg.MsgTo; Debug.Log(playerID); break; case MsgType.CsInitbattlesceneRes: DelegateManager.OnUpdateBattleSceneEvent(msg); break; case MsgType.CsBattlestartRes: //showMsg(msg); DelegateManager.OnUpdateBattleSceneEvent(msg); break; default: break; } } if (SendMsgList.Count > 0) { MsgPack msg = SendMsgList.Dequeue(); ProtoControl.SendMsg(msg); } }
void GenerateRandomObject(int level = Constant.LEVEL_1) { FoodController.FoodType foodType = DelegateManager.GetRandomFoodType(); FoodController fController = DelegateManager.GetFood(foodType); fController.IsUsed = true; PetIconController.PetType petType = DelegateManager.GetRandomPetType(level); PetIconController piController = DelegateManager.GetPetIcon(level, petType); piController.IsUsed = true; BaseObject controller = GetObjectInPool(); controller.ActivateBaseObject(true); controller.LinkFoodAndPetIcon(ref fController, ref piController); controller.ActivateFoodAndPetIcon(true); //controller.FDController = fController; //controller.PIController = piController; controller.UpdateObjectState(BaseObject.ObjectState.CanMoved); m_ListObjects.Add(controller); //Update position in here now + update last object reference Vector3 newPos = new Vector3(m_LastObject.GetTransformation().position.x + m_Offset, m_PosY, 0); controller.UpdatePositionInWorld(newPos); m_LastObject = controller; }
public WCFService(Func <IServiceBus> serviceBus, IMessageTracker tracker, IMessageBucket messages, DelegateManager manager) { this.serviceBus = serviceBus; this.tracker = tracker; this.messages = messages; this.manager = manager; }
void UpdateTimeRemain(float delta) { if (m_PetStat.m_IsDead) { m_ShouldUpdateTime = false; return; } int leftTime = CalculateRemaining(delta); int leftMinutes = 0, leftSeconds = 0; if (leftTime <= 0) { m_PetStat.m_IsDead = true; DelegateManager.UpdateDeadPet(1); //Notify that one pet has died } else { leftMinutes = leftTime / 60; leftSeconds = leftTime - leftMinutes * 60; } m_TextTime = leftMinutes.ToString("00") + ":" + leftSeconds.ToString("00"); m_TimeController.SetText(m_TextTime); }
void CheckBoardIsFull() { int count = 0; bool isbreak = false; for (int i = 0; i < Constant.ROW; ++i) { for (int j = 0; j < Constant.COLUMN; ++j) { if (m_Array[i, j] != null) { ++count; } else { isbreak = true; break; } } if (isbreak) { break; } } if (count == Constant.ROW * Constant.COLUMN) { DelegateManager.BroadcastEndGame(); } }
void OnApplicationPause(bool pausedStatus) { if (DelegateManager.BroadcastGameStatus != null) { DelegateManager.BroadcastGameStatus(pausedStatus); } m_IsPaused = pausedStatus; }
void UpdateDeadPet(int number = 1) { m_DeadPets += number; if (m_DeadPets >= Constant.PETS) { DelegateManager.BroadcastEndGame(); } }
void OnApplicationFocus(bool hasFocus) { if (DelegateManager.BroadcastGameStatus != null) { DelegateManager.BroadcastGameStatus(hasFocus); } m_IsPaused = !hasFocus; }
static void WriteStructWithFields(CodeOutput codeOutput, ClosureEntities crRuntime, Type type) { if (DelegateManager.IsTypeDelegate(type)) return; var mappedType = type.GetMappedType(crRuntime); type = mappedType.GetReversedMappedType(crRuntime); if (!type.IsValueType && type.BaseType != null) { //Not Necessary // codeOutput.AppendFormat("struct {0} : public {1} {2} {{", type.ToCppMangling(), type.BaseType.ToCppMangling(),type.GetInterfaces().Any()? " ,"+type.GetInterfaces().Select(j=>j.ToCppMangling()).Aggregate((a,b)=>a + " , " + b):""); codeOutput.AppendFormat( "struct {0} : public {1}", type.ToCppMangling(), type.BaseType.ToCppMangling()) .BracketOpen(); } else if (!type.IsValueType && type.IsInterface) { codeOutput.AppendFormat("struct {0} : public {1}", type.ToCppMangling(), typeof(object).ToCppMangling()) .BracketOpen(); } else { codeOutput.AppendFormat("struct {0}", type.ToCppMangling()) .BracketOpen(); } if (type == typeof(object)) { codeOutput.Append("int _typeId;\n"); } //String Support if (type == typeof(string)) { crRuntime.AddType(typeof(string)); var usedTypes = crRuntime.MappedTypes.Values.ToList(); var typeTable = new TypeDescriptionTable(usedTypes, crRuntime); codeOutput.Append("System_String()") .BracketOpen() .AppendFormat("_typeId = {0};\n", typeTable.GetTypeId(typeof(string))) .BracketClose() .BlankLine(); } WriteClassFieldsBody(codeOutput, mappedType, crRuntime); codeOutput.BracketClose(true) .Append(";\n") .BlankLine(); var typedesc = UsedTypeList.Set(type, crRuntime); typedesc.WriteStaticFieldInitialization(codeOutput); }
void Update() { if (m_IsPaused) { return; } #if UNITY_ANDROID || UNITY_IOS ///<summary> /// Handle touch first touch /// </summary> if (Input.touchCount > 0 && (Input.GetTouch(0).phase == TouchPhase.Began)) { if (m_CanHandleTouch) { var input = Input.GetTouch(0).position; if (Constant.IsDebug) { Debug.Log("Touch Input: " + input); } var worldPoint = m_Camera.ScreenToWorldPoint(input); worldPoint.z = 0; RaycastHit2D hit = Physics2D.Raycast(worldPoint, m_Camera.transform.forward, /*Mathf.Infinity*/ 100f, 1 << LayerMask.NameToLayer(Constant.LAYER_BASE_OBJECT)); if (hit) { GameObject obj = hit.collider.gameObject; DelegateManager.TouchBegin(obj, worldPoint); } } } ///<summary> /// Handle touch with drag /// </summary> if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) { var worldPoint = m_Camera.ScreenToWorldPoint(Input.mousePosition); worldPoint.z = 0; DelegateManager.TouchMove(worldPoint); } ///<summary> /// Handle touch end /// </summary> if (Input.touchCount > 0 && (Input.GetTouch(0).phase == TouchPhase.Canceled || Input.GetTouch(0).phase == TouchPhase.Ended)) { if (Constant.IsDebug) { Debug.Log("Touch phase: " + " Touch end"); } DelegateManager.TouchEnd(); } #endif DelegateManager.UpdateGame(Time.deltaTime); }
PetIconController.PetType GetRandomPetType(int level) { int minValue = (int)PetIconController.PetType.Pet01; int maxValue = ((int)PetIconController.PetType.PetMax) - 1; int randomValue = DelegateManager.GetRandomLevel(minValue, maxValue); return((PetIconController.PetType)randomValue); }
public ServiceBusHandler(Func<IServiceBus> serviceBus, HandlerContext handlerContext, Func<string, Response> response, IMessageBucket bucket, DelegateManager manager, Func<ControllerContext> controllerContext) { this.serviceBus = serviceBus; this.handlerContext = handlerContext; this.response = response; this.bucket = bucket; this.manager = manager; this.controllerContext = controllerContext; }
FoodController.FoodType GetRandomFoodType() { int minValue = (int)FoodController.FoodType.Food01; int maxValue = ((int)FoodController.FoodType.FoodMax) - 1; int randomValue = DelegateManager.GetRandomLevel(minValue, maxValue); return((FoodController.FoodType)randomValue); }
public ServiceBusHandler(Func <IServiceBus> serviceBus, HandlerContext handlerContext, Func <string, Response> response, IMessageBucket bucket, DelegateManager manager, Func <ControllerContext> controllerContext) { this.serviceBus = serviceBus; this.handlerContext = handlerContext; this.response = response; this.bucket = bucket; this.manager = manager; this.controllerContext = controllerContext; }
public override void Draw() { float time = 0; if (parent.HasComp <Lifetime>()) { time = parent.Comp <Lifetime>().lifetime; } else { return; } yval = DelegateManager.SineComposite(time, amp, period, vshift, composite); Vector2R metapos = new Vector2R(parent.body.velocity.Y, -parent.body.velocity.X); VMath.NormalizeSafe(ref metapos); metapos *= yval; Vector2R metaposfinal = parent.body.pos + metapos; Vector2R reflectfinal = parent.body.pos - metapos; if (drawLines) { if (previousMetaPos != Vector2R.Zero) { room.Camera.DrawLinePermanent(previousMetaPos, metaposfinal, 2f, parent.body.color, Length); } previousMetaPos = metaposfinal; //previousRelectPos = metaposfinal; if (reflective) { if (previousRelectPos != Vector2R.Zero) { room.Camera.DrawLinePermanent(previousRelectPos, reflectfinal, 2f, parent.body.color, Length); if (drawSpin) { room.Camera.DrawLinePermanent(previousMetaPos, reflectfinal, 2f, parent.body.color, Length); room.Camera.DrawLinePermanent(previousRelectPos, metaposfinal, 2f, parent.body.color, Length); } } previousRelectPos = reflectfinal; //previousMetaPos = reflectfinal; //whoa make this a flag } } else { room.Camera.AddPermanentDraw(parent.texture, metaposfinal, parent.body.color, parent.body.scale * waveScale, 0, Length); if (reflective) { room.Camera.AddPermanentDraw(parent.texture, reflectfinal, parent.body.color, parent.body.scale * waveScale, 0, Length); } } }
//StartCoroutine(yieldForAddDelegate()); //IEnumerator yieldForAddDelegate() { // yield return GameInstance.staticDelegate != null; // GameInstance.staticDelegate.addDelegate(DelegateEnum.Camera, setGroundedYAxis); //} void Awake() { //Debug.Log("GameInstance-->Awake "); instance = this; staticDelegate = GetComponent <DelegateManager>(); DontDestroyOnLoad(gameObject); }
public void OnEndDrag(PointerEventData eventData) { canvasGroup.blocksRaycasts = true; canvasGroup.alpha = 1f; DelegateManager.AvoidOverlap(DelegateManager.allUIObjects, DelegateManager.minDistance, rectTransform, DelegateManager.shouldRandomize); isDragging = false; }
//public IEnumerator RunToTarget (Vector3 target, bool selfRemoved, int factor) //{ // m_IsRunningToTarget = true; // //m_TargetPosition = target; // DelegateManager.CanHandleTouch(false); // while (m_Transform.position != m_TargetPosition) // { // Vector3 pos = Vector3.SmoothDamp(m_Transform.position, m_TargetPosition, ref m_Velocity, Constant.SMOOTH_TIME); // UpdatePositionInWorld(pos); // yield return null; // } // m_Velocity = Vector3.zero; // m_IsRunningToTarget = false; // if (selfRemoved) // { // //Handle current and other baseobject // DelegateManager.NotifyOtherObjectState(this, ObjectState.CanMoved); // UpdateObjectState(ObjectState.Sleeping); // UnLinkFoodAndPetIcon(); // //Remove this from list // DelegateManager.RemoveObjectFromList(this); // //Update other game stat // DelegateManager.UpdateStatWithFactor(factor); // } // else // DelegateManager.NotifyOtherObjectState(null, ObjectState.CanMoved); // DelegateManager.ShouldUpdateTime(true); // DelegateManager.ShouldKeepMoving(true); // DelegateManager.CanHandleTouch(true); // yield break; //} void UpdateGame(float deltaTime) { if (m_IsRunningToTarget) { if (m_Transform.position == m_TargetPosition) { m_IsRunningToTarget = false; if (m_TargetPosition == m_CachedPosition) { DelegateManager.NotifyOtherObjectState(null, ObjectState.CanMoved); } /*else * DelegateManager.NotifyOtherObjectState(this, ObjectState.CanMoved);*/ m_Velocity = Vector3.zero; m_TargetPosition = Vector3.zero; /////////////////////Try to change for level uo/////////////////////// //DelegateManager.ShouldUpdateTime(true); //if (m_SelfRemoved) //{ // m_SelfRemoved = false; // UpdateObjectState(ObjectState.Sleeping); // UnLinkFoodAndPetIcon(); // DelegateManager.ResetFood(); // // DelegateManager.UpdateStatWithFactor(1); //} //DelegateManager.ShouldKeepMoving(true); if (m_SelfRemoved) { m_SelfRemoved = false; UpdateObjectState(ObjectState.Sleeping); UnLinkFoodAndPetIcon(); DelegateManager.RemoveObjectFromList(this); DelegateManager.UpdateStatWithFactor(1); } else { DelegateManager.ShouldUpdateTime(true); DelegateManager.ShouldKeepMoving(true); } //////////////////////////////////////////////////////////////////////////// } else { Vector3 pos = Vector3.SmoothDamp(m_Transform.position, m_TargetPosition, ref m_Velocity, Constant.SMOOTH_TIME); UpdatePositionInWorld(pos); } } }
void SetUpFood() { //PetIconController.PetType petType = DelegateManager.GetRandomPetType(m_PetStat.m_CurrentLevel); FoodController.FoodType foodType = DelegateManager.GetRandomFoodType(); m_PetStat.m_FoodType = foodType; m_FoodType = DelegateManager.GetRequiredBaseObject(m_PetStat.m_CurrentLevel, m_PetStat.m_PetType, m_PetStat.m_FoodType); m_FoodType.UpdateObjectState(BaseObject.ObjectState.Frozen); m_FoodType.SetScale(m_Scale * Constant.UNIT); }
private void MoveRandomObject() { if (DelegateManager.allUIObjects.Items.Count < 1) { return; } int randomIndex = Random.Range(0, DelegateManager.allUIObjects.Items.Count); DelegateManager.RandomizePosition(DelegateManager.allUIObjects.Items[randomIndex].GetComponent <RectTransform>()); }
void TouchEnd() { if (m_State == ObjectState.Moving && m_CanHandleTouch) { DelegateManager.NotifyBaseObjectDeselect(this); if (!m_IsRunningToTarget) { DelegateManager.ShouldKeepMoving(true); } } }
public void wallBounce() { //if (room.PropertiesDict["wallBounce"]) //float levelwidth = room.game...; int levelwidth = room.WorldWidth; int levelheight = room.WorldHeight; if (parent.body.pos.X >= (levelwidth - parent.body.radius)) { //float off = parent.body.pos.X - (levelwidth - parent.body.radius); //parent.body.pos.X = (levelwidth - parent.body.radius - off) % room.worldWidth; parent.body.pos.X = DelegateManager.Triangle(parent.body.pos.X, room.WorldWidth - (int)parent.body.radius); if (parent.body.velocity.X > 0) { parent.body.velocity.X *= -1; } //parent.body.InvokeOnCollisionStay(null); //todo: find out why we needed null, fix this } if (parent.body.pos.X < parent.body.radius) { //float off = parent.body.radius - parent.body.pos.X; //parent.body.pos.X = (parent.body.radius + off) % room.worldWidth; parent.body.pos.X = DelegateManager.Triangle(parent.body.pos.X - parent.body.radius, room.WorldWidth) + parent.body.radius; if (parent.body.velocity.X < 0) { parent.body.velocity.X *= -1; } //parent.body.InvokeOnCollisionStay(null); } if (parent.body.pos.Y >= (levelheight - parent.body.radius)) { //float off = parent.body.pos.Y - (levelheight - parent.body.radius); //parent.body.pos.Y = (levelheight - parent.body.radius - off) % room.worldHeight; parent.body.pos.Y = DelegateManager.Triangle(parent.body.pos.Y, room.WorldHeight - (int)parent.body.radius); if (parent.body.velocity.Y > 0) { parent.body.velocity.Y *= -1; } //parent.body.InvokeOnCollisionStay(null); } if (parent.body.pos.Y < parent.body.radius) { //float off = parent.body.radius - parent.body.pos.Y; //parent.body.pos.Y = (parent.body.radius + off) % room.worldHeight; parent.body.pos.Y = DelegateManager.Triangle(parent.body.pos.Y - parent.body.radius, room.WorldHeight) + parent.body.radius; if (parent.body.velocity.Y < 0) { parent.body.velocity.Y *= -1; } //parent.body.InvokeOnCollisionStay(null); } }
void TouchBegin(GameObject obj, Vector3 pos) { if (m_State == ObjectState.CanMoved && m_CanHandleTouch && this.gameObject == obj) { UpdateObjectState(ObjectState.Moving); //m_Transform.position = pos; UpdatePositionInWorld(pos); DelegateManager.NotifyOtherObjectState(this, ObjectState.None); DelegateManager.ShouldKeepMoving(false); } }
public void OnBeginDrag(PointerEventData eventData) { canvasGroup.blocksRaycasts = false; canvasGroup.alpha = DelegateManager.dragAlpha; if (DelegateManager.currentCraftingMaterials.Contains(eventData.pointerDrag)) { DelegateManager.currentCraftingMaterials.Remove(eventData.pointerDrag); DelegateManager.updateCurrentCraftingMaterials(); } isDragging = true; }
void OnPause(bool pausedStatus) { if (pausedStatus) { if (m_State == ObjectState.Moving) { UpdatePositionInWorld(m_CachedPosition); m_State = ObjectState.CanMoved; DelegateManager.NotifyOtherObjectState(this, ObjectState.CanMoved); DelegateManager.ShouldKeepMoving(true); } } }
void OnMouseUp() { if (m_State == ObjectState.Moving && m_CanHandleTouch) { DelegateManager.NotifyBaseObjectDeselect(this); if (!m_IsRunningToTarget) { DelegateManager.ShouldKeepMoving(true); } // m_IsSelected = false; // DelegateManager.TouchNotification (true); } }
private void Start() { for (int i = 0; i < playerPowerUpLevel.Length; i++) { playerPowerUpLevel[i] = POWERUPLEVEL.levelOne; currentPowerLevel[i] = 1; } dm = DelegateManager.dm; dm.powerUp_Water_Delegate += powerUpWaterDelegate; dm.powerUp_Snow_Delegate += powerUpSnowDelegate; dm.powerUp_Thunder_Delegate += powerUpThunderDelegate; }
private static void WriteClosureStructBodies(Type[] typeDatas, StringBuilder sb, CrRuntimeLibrary crRuntime) { foreach (var typeData in typeDatas) { var mappedType = typeData.GetMappedType(); if (!mappedType.IsGenericType) { sb.AppendFormat("struct {0}; ", mappedType.ToCppMangling()).AppendLine(); } } foreach (var typeData in typeDatas) { if (DelegateManager.IsTypeDelegate(typeData)) { continue; } var type = typeData.GetMappedType(); var mappedType = typeData; if (mappedType.IsGenericType) { var genericTypeCount = mappedType.GetGenericArguments().Length; var typeNames = new List <string>(); for (var i = 1; i <= genericTypeCount; i++) { typeNames.Add("class T" + i); } sb.AppendFormat("template <{0}> ", string.Join(", ", typeNames)).AppendLine(); } if (!type.IsValueType && type.BaseType != null) { sb.AppendFormat("struct {0} : public {1} {{", type.ToCppMangling(), type.BaseType.ToCppMangling()); } else { sb.AppendFormat("struct {0} {{", type.ToCppMangling()); } sb.AppendLine(); if (type == typeof(object)) { sb.AppendLine("int _typeId;"); } WriteClassFieldsBody(sb, mappedType, crRuntime); sb.AppendFormat("}};").AppendLine(); var typedesc = UsedTypeList.Set(type, crRuntime); typedesc.WriteStaticFieldInitialization(sb); } }
// Use this for initialization void Start() { if (m_Camera == null) { m_Camera = Camera.main; } m_CanHandleTouch = true; DelegateManager.OnLoadGameData(); DelegateManager.StartGame(); //DelegateManager.DisplayQuests (); }
public WCFAdapter(WCFProxy<IWCFProtocol> protocol, Func<IServiceBus> serviceBus, DelegateManager manager) { this.protocol = protocol; this.serviceBus = serviceBus; this.manager = manager; }